How to rotate the other way round

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