- Home /
How can i make change the First Person position by clicking a Buttom?
How can i make change the First Person position by clicking a Buttom?
In other words, With Which Script command can I change my First Person or Camera View position, With a click on a button? Well to Fly from position A to position B
Thank you
Answer by mcadieux · Mar 25, 2010 at 01:15 PM
Check out http://unity3d.com/support/documentation/Components/GUI%20Scripting%20Guide.html for a guide on UnityGUI if you haven't seen it yet. I would do something like:
function OnGUI ()
{
if (GUI.Button (Rect (10,10,150,100), "MOVE"))
{
Move();
}
}
This will draw the button and call the function Move() when it is clicked. Now in your Move function you place the code to move the object.
Answer by KvanteTore · Mar 25, 2010 at 11:04 AM
Take a look at this question. It might be related to what you want. Which object you want to change the position of depends on the way you have set up your object hierarchy.
To get whether a button (spacebar) is pressed, you can use Input.GetKeyDown(KeyCode.Space)