Obi Official Forum
Help Setting angular velocity of a kinematic body is not supported - Printable Version

+- Obi Official Forum (https://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: Obi Rope (https://obi.virtualmethodstudio.com/forum/forum-4.html)
+--- Thread: Help Setting angular velocity of a kinematic body is not supported (/thread-4203.html)



Setting angular velocity of a kinematic body is not supported - vrtraining - 06-05-2024

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


RE: Setting angular velocity of a kinematic body is not supported - josemendez - 06-05-2024

(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/forum/thread-3604.html?highlight=kinematic

kind regards,