# Rotate object around transform.forward

Hello!
I am trying to rotate an object around it’s forward vector. But something is going wrong.
This is what I did when the object’s rotation is identity and the object has no parent.

• Rotate around local up vector by 90 degrees (now forward vector is (1,0,0) which is correct)
• Rotate around local forward vector by 90 degrees (now forward vector should stay the same since I am rotating around the forward vector but it strangely changes to (0,1,0))

This has been blocking my progress quite a lot. Any sort of help will be really appreciated.
Here is the code for the rotations. I have also tried it by concatenating quaternion rotations but it gives same result.

``````  private IEnumerator RotateAroundForward (int dir)
{
var t = 0.0f;
var start = transform.localEulerAngles;
var end = start + transform.forward * 90.0f * dir;
while (t < 1.0f)
{
t += Time.deltaTime * rotateSpeed;
transform.localEulerAngles = Vector3.Lerp (start, end, t);
yield return null;
}
}

private IEnumerator RotateAroundUp (int dir)
{
var t = 0.0f;
var start = transform.localEulerAngles;
var end = start + transform.up * 90.0f * dir;
while (t < 1.0f)
{
t += Time.deltaTime * rotateSpeed;
transform.localEulerAngles = Vector3.Lerp (start, end, t);
yield return null;
}
}

private IEnumerator RotateAroundRight (int dir)
{
var t = 0.0f;
var start = transform.localEulerAngles;
var end = start + transform.right * 90.0f * dir;
while (t < 1.0f)
{
t += Time.deltaTime * rotateSpeed;
transform.localEulerAngles = Vector3.Lerp (start, end, t);
yield return null;
}
}
``````

Thanks

Euler angles are often pretty useless if you do sequences of rotation around more than 1 axis.