:shock: Noob Crisis: Averted! (Another one bites the dust…) :shock:
I’ve now began playing with Transforms on my Camera! For my title screen, I’m trying to get the Camera to move forward two world units while also rotating up about fifteen degrees, over a span of two (subject to tuning) seconds - a little camera whoosh! However, my code isn’t making this happen:
function Update()
{
if( titleState == 0 )
{
// Title-> Load/New Game Scenario:
// We want to set the new state, whoosh our
// camera in a cool way, THEN let the OnGUI
// know that it should render.
if( Input.GetKeyDown( KeyCode.Return ) )
{
var isDone = Time.timeSinceLevelLoad + 2;
while( Time.timeSinceLevelLoad < isDone )
{
transform.Translate( 0,0, 2 * Time.deltaTime );
transform.Rotate( -15 * Time.deltaTime, 0,0 );
yield;
}
titleState = 1;
}
}
}
For some reason, this dosen’t even execute at all! When I remove the while loop, it will hop forward and rotate up a little, as it should. How do I prolong this effect to the point I would like it to be?