hello All
I have 2 parallel roads (call them Good & Bad), and a character controller traversing one
At certain points, you mouseUp something & go to the other road and explore a bit …Fine.
But when you go back, either with user input, or via a timer,
I need you to go back to the exact position you were originally on when you left the first road
(are all variables global : i.e. move between scripts?)
So, the following partially work to translate camera but how to get it back is a mystery …
1) I would make a private variable called myPos to store the original position of the camera on the first mouseUp script:
var myCamera: Camera;
// set variable to hold my Current position:
private var myPos: int = (0, 0, 0);
function OnMouseUp () {
// I need to record the position of the Camera??
myCamera.position = myPos;
// move camera and set as active (works)
myCamera.transform.Translate(0,12,0);
myCamera.camera.enabled = true;
}
2) on the next MouseUp return camera to Position myPos:
var myCamera: Camera;
private var myPos: int;
function OnMouseUp () {
// I need to put the camera back to original position
myCamera.position = myPos
myCamera.camera.enabled = true;
}
Thanks So much !