- Home /
Question by
One-Unity-One-World · Mar 31, 2010 at 03:35 PM ·
cameraguifirst-person
Klick a Button to Fly from A to B.
How can i make change the First Person or Camera position by clicking a Buttom?
In other words, With Which GUI-JavaScript command can I change my First Person or Camera View position, With a click on a button? I want to Fly from position A to position B
Thank you
Comment
Best Answer
Answer by e-bonneville · Mar 31, 2010 at 05:25 PM
Try this:
function OnGUI () {
if (GUI.Button (Rect (10,10,150,100), "I am a button")) {
transform.Translate (0,10,0);
}
}
That will move your camera from point a to point b instantaneously. All you have to do is put it on your camera. On the press of a button, it will move from where it is now to wherever you specify in this line:
transform.Translate (0,10,0);
.
Hope this helps!