- Home /
Continue Movement of camera
hey, i want to continue the movement of the camera until it has reached it target here is my code:
var transitionDuration : float = 2.5f; var target : Transform; var timer : int = 0;
var transitionDuration : float = 2.5f;
var target : Transform; var timer : int = 0;
function Update() { if(Input.GetKey("Fire1")) {
Transition();
}
} function Transition() { var t : float = 0.0f; var startingPos : Vector3 = transform.position; while (t < 1.0f) { t += Time.deltaTime * (Time.timeScale/transitionDuration);
transform.position = Vector3.Lerp(startingPos, target.position, t);
Debug.Log(transitionDuration);
return 0;
}
}
Answer by Berenger · May 06, 2012 at 05:48 AM
It's a good start, but you need to use the keyword yield, not return. "yield null;" to be accurate. This will pause the execution of the loop until the next frame.
Your answer
Follow this Question
Related Questions
Android Cardboard - Fake UI Overlay 0 Answers
Android Unity ARCore camera access 0 Answers
OnRenderImage in one of the two cameras, Android showing only post processed camera. 1 Answer
my camera show an extremely weird aspect [android] 0 Answers
I have for example 10 pixels, how to make width of camera with 10 pixels? 0 Answers