Hi,
I’m wondering, is it possible to delay transform.rotation by any way at all ?
I know it’s pretty easy with transform.rotate
But as i’m using an angle (right stick of the gamepad) to rotate an object, i’m not sure i can do it with rotate.
Here is the code i use :
float Angle = Mathf.Atan2 (Input.GetAxis ("R_StickX"), Input.GetAxis ("R_StickZ")) * Mathf.Rad2Deg;
transform.rotation = Quaternion.Euler(new Vector3(0,Angle,0));
Thanks !
Hey,
Thanks for answering !
I just did…
The only thing i could come up with was :
- a target object with no delay on the rotation (using transform.rotation)
- my delayed object using Quaternion.RotateTowards this way :
transform.rotation = Quaternion.RotateTowards(transform.rotation,GameObject.Find ("mytargetobject").transform.rotation , 1F * Time.deltaTime);
It’s not working.
I dont really get why, as i can Debug.Log the target rotation, and it’s actually rotating.
adjusting your code…
float Angle = Mathf.Atan2 (Input.GetAxis ("R_StickX"), Input.GetAxis ("R_StickZ")) * Mathf.Rad2Deg;
transform.rotation = Quaternion.RotateTowards(transform.rotation, Quaternion.Euler(new Vector3(0,Angle,0), 5);