Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Setting angular velocity of a kinematic body is not supported
#1
Im getting this error 

Code:
Setting linear velocity of a kinematic body is not supported.

If I manually set my Game Object Rigidbody to Kinematic during runtime, I keep getting this error. Its coming from ObiRigidBody.cs

Code:
private void UpdateKinematicVelocities(float stepTime)
        {
            // differentiate positions/orientations to get our own velocites for kinematic objects.
            // when calling Physics.Simulate, MovePosition/Rotation do not work correctly. Also useful for animations.
            if (unityRigidbody.isKinematic)
            {
                // differentiate positions to obtain linear velocity:
                unityRigidbody.velocity = (transform.position - prevPosition) / stepTime;

                // differentiate rotations to obtain angular velocity:
                Quaternion delta = transform.rotation * Quaternion.Inverse(prevRotation);
                unityRigidbody.angularVelocity = new Vector3(delta.x, delta.y, delta.z) * 2.0f / stepTime;
            }

            prevPosition = transform.position;
            prevRotation = transform.rotation;
        }


Any idea that I could suppress or get rid of this warning? Im using latest 6.5 version with Unity 2023.2.19f
Reply
#2
(06-05-2024, 02:38 PM)vrtraining Wrote: Im getting this error 

Code:
Setting linear velocity of a kinematic body is not supported.

If I manually set my Game Object Rigidbody to Kinematic during runtime, I keep getting this error. Its coming from ObiRigidBody.cs

Code:
private void UpdateKinematicVelocities(float stepTime)
        {
            // differentiate positions/orientations to get our own velocites for kinematic objects.
            // when calling Physics.Simulate, MovePosition/Rotation do not work correctly. Also useful for animations.
            if (unityRigidbody.isKinematic)
            {
                // differentiate positions to obtain linear velocity:
                unityRigidbody.velocity = (transform.position - prevPosition) / stepTime;

                // differentiate rotations to obtain angular velocity:
                Quaternion delta = transform.rotation * Quaternion.Inverse(prevRotation);
                unityRigidbody.angularVelocity = new Vector3(delta.x, delta.y, delta.z) * 2.0f / stepTime;
            }

            prevPosition = transform.position;
            prevRotation = transform.rotation;
        }


Any idea that I could suppress or get rid of this warning? Im using latest 6.5 version with Unity 2023.2.19f

Hi,

There's a patch available to get rid of this warning (introduced by Unity in 2022), you can find it here:
https://obi.virtualmethodstudio.com/foru...=kinematic

kind regards,
Reply