- Home /
How do I make accessible buildings in Unity 4
Im making a short experimental horror game and I understand allot of things about modelling and stuff but how do I make a good building that you can enter and exit?
using blender and unity cube meshes dosent seem right or if it is right can someone tell me how to do it?
If you understand a lot about modeling, you can model any building in blender, then import the mesh(es) and you have it.. this question is not specific.
If player step into entrance, should be new scene loaded, presenting buildings inside ? For example like in Baldurs Gate ? Or should be inside of building just part of one scene ?
$$anonymous$$odel the inside seperetly and then you can script it so that when player enters it will show the inside.
Check out the Bootcamp Demo. It has some interiors with advanced lighting and details. They use layers very effectively to seperate the different parts of buildings.
Answer by Mrmudweasel · Jan 17, 2013 at 10:55 PM
I found the same problem while creating my games, i created this script, apply it to a invisible object and set the box collider to trigger, also when you walk out of the box the GUI disappears here is my code:
var showMessage : boolean;
function OnGUI(){
if(showMessage){
// Make a background box
GUI.Box (Rect (158,10,100,90), "Enter house");
// Make the first button. If it is pressed, Application.Loadlevel (1) will be executed
if (GUI.Button (Rect (168,40,80,20), "enter")) {
Application.LoadLevel (1);
}
// Make the second button.
GUI.Label (Rect (168,70,80,20), " my house");
}
}
//makes it so when you walk in it shows the GUI
function OnTriggerEnter(){
showMessage = true;
}
//makes it so when you walk out of the object the GUI disapears
function OnTriggerExit(){
showMessage = false;
}
$$anonymous$$rmud! Thanks, this is the only good answer I have seen. Unfortunately I put my game on hiatus because I couldn't figure it out! So ideally I should place an unoccupied object on the door so you can enter there and exit there?
Well, is what you would do is take a unity cube and place it on the ground and space it out in front of the door so that when the player gets near the door the player touches it. Add the script provided, there should be a little checkbox somewhere on the object towards the top that says "is trigger" check that and you should be good to go.
Your answer
Follow this Question
Related Questions
Standard shader not working on procedural mesh 0 Answers
Drawing new mesh not working 1 Answer
Weird Line Between Meshes 1 Answer
How to take a chunk out of a mesh at runtime 1 Answer
One mesh but few materials 0 Answers