I’m struggling to get my head around this, but basically - I have a ResetRotation function in where I want it to:
yield WaitForSeconds(2);
and then reset the Y rotation to ‘0’ over time (so it looks like its animated).
How would one go about doing that?
Thanks
I added a second gif which covers the rest of the process to the README.md. http://i.imgur.com/02sruZr.gif You can see here the object getting logged when it becomes visible. This is clean project where I only added the 'AutomationHelpers.unitypackage' file before starting the capture. I hope this helps
Time.time starts counting at the start of the game, not at the start of this specific reset. In the reset function Anxo posted you could have var timer : float = Time.time and in the transform.Rotate replace Time.time with Time.time-timer
@Oliver Jones when you say "This does not work, any idea why? What do you mean? does it pop out an error? link the code you tried it with, mine was just an example to use as base you may not be able to copy and paste. please link the code you tried this with.
function ResetRotation(){
var oldY : float = transform.eulerAngles.y;
var t : float = 0.0;//animation time
var speed : float = 1.0; //how fast you want the rotation to happen
while(t < 1.0){
transform.eulerAngles.y = Mathf.Lerp(oldY, 0.0, t); //rotate to the new position
t += Time.deltaTime * speed; //animate the time variable
yield; //yield til the next frame
}
}
Just call that function when you're ready to rotate back to 0, and it should handle the rest.
I added a second gif which covers the rest of the process to the README.md. http://i.imgur.com/02sruZr.gif You can see here the object getting logged when it becomes visible. This is clean project where I only added the 'AutomationHelpers.unitypackage' file before starting the capture. I hope this helps
– ujappelbe