- Home /
AngleAxis or Lerp: change both rotation and speed?
Hi,
I would like to rotate around an object, with AngleAxis it works well but I can't (I think) modify the speed of the rotation, and with a lerp, the negative value does not work with my code, it keeps on rotating, and I don't know how to ask the rotation to start from one specific side (if I want the rotation to rotate from the left, or from the right of the object).
Is there a way to do both things with one of these methods? Rotate and choose the side of rotation, and rotate with a specific speed?
Here is the code :
//#1
target.localRotation = Quaternion.AngleAxis(170, Vector3.up);
//-170 works well, but no indication about speed
//#2
_y = 170;//-170 keeps on rotating
float lerp = Mathf.Lerp(target.localEulerAngles.y, _y, Time.deltaTime * 3);
target.localEulerAngles = new Vector3(0, lerp, 0);
Thanks
Answer by whydoidoit · Oct 17, 2013 at 04:43 PM
target.localRotation = Quaternion.Slerp(transform.localRotation, Quaternion.AngleAxis(170, Vector3.up), Time.deltaTime * 3);
Your answer
Follow this Question
Related Questions
Rotation jumping to a different rotation after rotating a certain amount 0 Answers
Per-Axis (Euler) Rotation Control While Avoiding Gimbal Lock 1 Answer
How to add rotation to current rotation over time? 2 Answers
How do you smoothly transition/Lerp into a new rotation? 3 Answers
Rotation Lerp 2 Answers