I rotate Rigidbody faster, but speed of Rigidbody decreasing in Inspector

Hello

I rotate some Rigidbody around my player using MovePosition and MoveRotation.
But than faster I rotate this body - Speed of Rigidbody in Inspector became low and low.

How it possible?

Post some code that replicates your problem in as simple terms as possible. I’m assuming this is a kinematic rigidbody as you are using MovePosition/Rotation?

1 Like

No, no kinematic.

In FixedUpdate() I do next:

private void FixedUpdate()
    {
        if (currentRope && currentDropChild)
        {
            Rigidbody dorb = currentDropChild.GetComponent<Rigidbody>();
            if (dorb)
            {
                RotateRigidBodyAroundPointBy(dorb, transform.position, new Vector3(0, 1, 0), [B]dropRotationSpeed[/B] * Time.deltaTime, 2.0f);
            }
          
        }
    }

public void RotateRigidBodyAroundPointBy(Rigidbody rb, Vector3 origin, Vector3 axis, float angle)
    {
        Quaternion q = Quaternion.AngleAxis(angle, axis);
        rb.MovePosition(q * (rb.transform.position - origin) + origin);
        rb.MoveRotation(rb.transform.rotation * q);
    }

In Update I just increase/decrease dropRotationSpeed value:

 if (Input.GetKey(KeyCode.Alpha1))
        {
            dropRotationSpeed += 15f;

        }
        if (Input.GetKey(KeyCode.Alpha2) && dropRotationSpeed > 0.5f)
        {
            dropRotationSpeed -= 15f;
        }

And I looking in Inspector in Runtime - and Speed behaviour is very strange

You should not be moving a non-kinematic rigidbody with MovePosition/Rotation:

“Moves the kinematic Rigidbody towards position.”

If you move it, you are “teleporting” it (the only advantage of Move is it allows collision detection for kinematics and works out a velocity for you), this won’t affect the velocity of a non-kinematic rigidbody.

You either need to make your body kinematic and use MovePosition/Rotation or if non-kinematic use AddForce/AddTorque (ideally) or less ideally set rb.velocity directly (more problematic, but sometimes OK).

1 Like

Wow. Thank you!

1 Like

Also, another thing worth noting is that when you increase the rotation speed, it will eventually rotate around more than 180 degrees in one frame. If it rotates exactly 360 degrees, it will appear to not be rotating at all, and MoveRotation will assume an angular velocity of 0.