I am rotating an object (throwing axe) with rb.MoveRotatation, like in the API documentation:
void FixedUpdate()
{
// eulerAngleVelocity = new Vector3(400, 0, 0);
Quaternion deltaRotation = Quaternion.Euler(eulerAngleVelocity * Time.fixedDeltaTime);
rb.MoveRotation(rb.rotation * deltaRotation);
}
This lets the object rotate around the red axis nicely. However, the axe spins in the wrong direction. I need a rotation around the red axis but in the other direction.
I played around with -1 * eulerAngleVelocity, but the outcome is always the same. How do i achieve that?
Thx in advance!
I would imagine you just use -eulerAngleVelocity to change the axis of rotation to the reverse.
But I’d say rather than using Quaternion.Euler, I would recommend using Quaternion.AngleAxis instead to generate a rotation on a specific axis:
void FixedUpdate()
{
Quaternion axisRotation = Quaternion.AngleAxis(speed * Time.fixedDeltaTime, transform.right);
rb.MoveRotation(rb.rotation * deltaRotation);
}
Then you can either reverse the axis (-transform.right) or supply a negative angle instead if you need to change the rotation direction.
1 Like
Hey guys, after some more testing it turns out that -eulerAngleVelocity works, which i also tried before. The reason why i thought that it does not work is because from a 1st person perspective the axe seems to be spinning in a wrong direction which is an illusion only. When i look at the axe from the side, it turns out that the spinning direction is correct.