- Home /
Big noob Need to know how I can make that
I want my fps camera to teleport to another scene when it press a button.
Let's put it like this. I've got a house, I want the character to be teleported to another scene (that will be the house interior) when he presses a button of my choice in front of the door.
Can someone tell me how can i do taht on script or even better! to give me the whole script, because Im seriously a great noob, I've search for a very long time what command lines I should use but i didnt find any!
PLEASE HELP ME!
Answer by Thom Denick · Feb 13, 2011 at 03:29 AM
There are an awful lot of things your asking for here. Try to focus your questions in the future. Focus on one aspect of your implementation at a time.
You need to do a Mouse Interaction with a 3D Object http://answers.unity3d.com/questions/5339/click-on-a-3d-object-in-the-game
You need to Load a new scene once your button is hit: http://unity3d.com/support/documentation/ScriptReference/Application.LoadLevel.html
You need to move your character to the correct position. This is a very simple scripting operation, if you need help with that, please run through some scripting tutorials!
thing is I don't know the script for keyboard buttons, everyone seems to use inputs so I didnt understand how you write this kind of script.
Ah I see, I thought you meant you wanted the player to press a button in 3D space, not the keyboard. So to check for a keyboard press you just use Get$$anonymous$$eyDown, which you can read more about here: http://unity3d.com/support/documentation/ScriptReference/Input.Get$$anonymous$$eyDown.html
Thank you so much.
Listen I got another problem now here is the script i used on an object "door" mesh. function OnTriggerEnter(other : Collider) { if (Input.Get$$anonymous$$eyDown ("e")) Application.LoadLevel (1);
}
function Awake () { DontDestroyOnLoad (transform.gameObject); transform.position = Vector3(71,79,-456);
}
I used it in the door, and when I start the game the door suddenly disapear why?
I didnt turned the "trigger button" on.
I made up something else, I deleted the function awake and the door didnt disapear anymore.
BUt I couldn't get the script to work.
I just want my FPS controller to teleport itself when he hits the E key in front of the door...
Your answer
![](https://koobas.hobune.stream/wayback/20220613104026im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Issue with my Teleport Script 1 Answer
Animation Script not working. 1 Answer
The associated script cannot be loaded. 1 Answer
Can a script be loaded to a next scene? 3 Answers
Audio play when object hit collision. 2 Answers