Search Unity

School Project, need a little help please:D

Discussion in 'Editor & General Support' started by AdriaFace, Jul 28, 2013.

  1. AdriaFace

    AdriaFace

    Joined:
    Jul 28, 2013
    Posts:
    9
    Hello guys :D

    Well, im developing my own game with unity because a school project this summer, i wanted to make a horror game but i have a problem, i want to make a game with external and internal (inside houses) places, but i dont know how to make accesible buildings, can someone help me ?

    Thanks so much!
    Im sorry for my level, im starting
     
  2. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,879
    By accessible buildings, do you mean interactable house doors (openable, closable)? If so, the most proper approach would be using Raycasting.
     
  3. AdriaFace

    AdriaFace

    Joined:
    Jul 28, 2013
    Posts:
    9
    Yeah like ammnesia, just enter to a house room and then be in.
     
  4. chrisall76

    chrisall76

    Joined:
    May 19, 2012
    Posts:
    667
    If you mean opening doors, raycast and animations will help.
    If you mean a actual environment creator, use a 3D modeling tool such as Blender.
     
  5. AdriaFace

    AdriaFace

    Joined:
    Jul 28, 2013
    Posts:
    9
    yeah i want to be into a house and then be there, but in unity i can only make a terrain but not houses accesibles
     
  6. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,879
    There are two kinds of doors in Amnesia (that is a horrifying game by the way :D ). Doors that you open/close as you desire by draggind the mouse button and doors that changes the entire scene (i.e. moves you from the library to the castle hall or to the cellar etc.). Second one is pretty easy to implement. When you click the door while being close to it, you just change the scene with Application.LoadLevel( ... ). For the first one, you may want to consider using physics functions or perhaps simple rotation functions (like transform.Rotate( ... ) ).

    But if you are asking how to create a house and place it in Unity, then you should use a modelling tool like 3DS Max or Google Sketchup (a nice program for creating houses) and then simply import your house into Unity.
     
  7. AdriaFace

    AdriaFace

    Joined:
    Jul 28, 2013
    Posts:
    9
    Thanks for you reply :D

    Now i have a 3D House , but i want to make it accesible to enter to another Scene only by going near the door, how can i do that? thanks:D
     
  8. Frostbite23

    Frostbite23

    Joined:
    Mar 8, 2013
    Posts:
    458
    you can code a simple script like this. (make sure you have the other scene ready)

    Code (csharp):
    1. #pagrama strict
    2.  
    3. function OnTriggerEnter (other : Collider) {
    4.      Application.LoadLevel(1);
    5. //you can change the number to the actual scene number (when you enter the house scene) number
    6.  
    7. }
    Make a cube or plane on the door. make sure you have the collider component in the cube or plane (whatever your using).
    and than go to the collider settings and set the Is Trigger or something like that (i dont have unity installed) Set it On and put the script on the cube. Smack the play button and it should work. oh wait go to the file settings File > Build Settings? and put the levels in there.

    i dont have unity installed so i dont know if it works but it should
     
    Last edited: Jul 29, 2013
  9. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,879
    Like Frostbite23 said, create a Cube GameObject and place it in front of the door. Deselect (disable) its "Mesh Renderer" component to make it invisible. And select "Is Trigger" from Collider component. This way when your character collides with the cube, it will pass through it rather than crashing it. To change the scene, you can use Application.LoadLevel( "sceneToChange" ). Using a String parameter is more legible. Be sure that all the scenes in your game are added to "Scenes in Build" list in Build Settings!
     
    Last edited: Jul 30, 2013
  10. Frostbite23

    Frostbite23

    Joined:
    Mar 8, 2013
    Posts:
    458
    yeah, i forgot about the string parameter.
     
  11. AdriaFace

    AdriaFace

    Joined:
    Jul 28, 2013
    Posts:
    9
    Thank you so much guys, i need a little help now.

    I Want to put a text while the player is playing, like at the top of the screen and without any funtion. But i dont know how to do it, can someone help me ? thanks guys! :D
     
  12. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,879
    2 ways to do it:

    - use GUI.Label in OnGUI function
    - use a GUIText object. Still, you need to write a script if the content of this text will change during gameplay.