Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Setting linear velocity of a kinematic body is not supported
#1
Hello,

We are currently in the process of upgrading our project from Unity 2020.3.26f1 to Unity 2022.1.17f1

We get spammed by this message

Quote:Setting linear velocity of a kinematic body is not supported.
UnityEngine.Rigidbody:set_velocity (UnityEngine.Vector3)
Obi.ObiRigidbody:UpdateKinematicVelocities (single) (at Assets/Obi/Scripts/Common/Collisions/ObiRigidbody.cs:34)
Obi.ObiRigidbody:UpdateIfNeeded (single) (at Assets/Obi/Scripts/Common/Collisions/ObiRigidbody.cs:47)
Obi.ObiColliderWorld:UpdateRigidbodies (System.Collections.Generic.List`1<Obi.ObiSolver>,single) (at Assets/Obi/Scripts/Common/Collisions/ObiColliderWorld.cs:378)
Obi.ObiUpdater:BeginStep (single) (at Assets/Obi/Scripts/Common/Updaters/ObiUpdater.cs:55)
Obi.ObiFixedUpdater:FixedUpdate () (at Assets/Obi/Scripts/Common/Updaters/ObiFixedUpdater.cs:46)


and this one

Quote:Setting angular velocity of a kinematic body is not supported.
UnityEngine.Rigidbody:set_angularVelocity (UnityEngine.Vector3)
Obi.ObiRigidbody:UpdateKinematicVelocities (single) (at Assets/Obi/Scripts/Common/Collisions/ObiRigidbody.cs:38)
Obi.ObiRigidbody:UpdateIfNeeded (single) (at Assets/Obi/Scripts/Common/Collisions/ObiRigidbody.cs:47)
Obi.ObiColliderWorld:UpdateRigidbodies (System.Collections.Generic.List`1<Obi.ObiSolver>,single) (at Assets/Obi/Scripts/Common/Collisions/ObiColliderWorld.cs:378)
Obi.ObiUpdater:BeginStep (single) (at Assets/Obi/Scripts/Common/Updaters/ObiUpdater.cs:55)
Obi.ObiFixedUpdater:FixedUpdate () (at Assets/Obi/Scripts/Common/Updaters/ObiFixedUpdater.cs:46)


Upon investigation, we saw this message from a Unity dev https://forum.unity.com/threads/kinemati...st-7822350
and also noted that they added this line in the 2022.1 docs (last line at the bottom)
Quote:Additionally, setting the linear velocity of a kinematic rigidbody is not allowed and will have no effect.

The obi code actually checks if the body is Kinematic before setting the velocity and angularVelocity.

We'll comment this code out since it's not suppose to affect anything.

Is this code suppose to be useful or is it obsolete?

Cheers
Reply
#2
(30-09-2022, 08:35 PM)bagelbaker Wrote: Hello,

We are currently in the process of upgrading our project from Unity 2020.3.26f1 to Unity 2022.1.17f1

We get spammed by this message



and this one



Upon investigation, we saw this message from a Unity dev https://forum.unity.com/threads/kinemati...st-7822350
and also noted that they added this line in the 2022.1 docs (last line at the bottom)

The obi code actually checks if the body is Kinematic before setting the velocity and angularVelocity.

We'll comment this code out since it's not suppose to affect anything.

Is this code suppose to be useful or is it obsolete?

Cheers

Hi!

For the most part, this can be commented out without adverse effects. Commenting this code out will disable continuous collision detection for kinematic objects, so if you have fast objects that move by setting their transform position directly, they will use static collision detection instead.

This is a known issue that has been fixed, not yet published: up until 2022, Unity allowed to write rigidbody velocities even if the rigidbody was kinematic. Obi 7 will contain a fix for this issue.

kind regards,
Reply
#3
Still running into this with latest Obi Rope package and latest Unity 2022 LTS.  Any particular reason this code hasn't been removed/deprecated yet before I locally modify the package?  Thanks!
Reply
#4
(27-07-2023, 07:33 PM)travis-tap3d Wrote: Still running into this with latest Obi Rope package and latest Unity 2022 LTS.  Any particular reason this code hasn't been removed/deprecated yet before I locally modify the package?  Thanks!

Hi,

We had to make a few significant changes to make it work together with continuous collision detection. It’s scheduled to land in the next update (6.5.4).

Once I get to the office tomorrow morning I’ll send you a patch for 6.5.3.

kind regards,
Reply
#5
Hi!

Here's a patch for 6.5.3 that circumvents this issue in 2022 and up while keeping proper CCD support for rigidbodies. Replace
Obi/Scripts/Common/Collisions/ObiRigidbody.cs
Obi/Scripts/Common/Collisions/ObiRigidbody2D.cs
Obi/Scripts/Common/DataStructures/ColliderRigidbody.cs

With the ones you'll find attached. Let me know if you run into any issues,

kind regards


Attached Files
.cs   ColliderRigidbody.cs (Size: 3.24 KB / Downloads: 22)
.cs   ObiRigidbody.cs (Size: 3.08 KB / Downloads: 22)
.cs   ObiRigidbody2D.cs (Size: 2.92 KB / Downloads: 19)
Reply
#6
(28-07-2023, 08:03 AM)This worked fine with 6.5.1 too.  Thanks.   josemendez Wrote: Hi!

Here's a patch for 6.5.3 that circumvents this issue in 2022 and up while keeping proper CCD support for rigidbodies. Replace
Obi/Scripts/Common/Collisions/ObiRigidbody.cs
Obi/Scripts/Common/Collisions/ObiRigidbody2D.cs
Obi/Scripts/Common/DataStructures/ColliderRigidbody.cs

With the ones you'll find attached. Let me know if you run into any issues,

kind regards
Reply