Skip to content

Commit

Permalink
chore(physHelper): Change of collision detection mode when enabling/d…
Browse files Browse the repository at this point in the history
…isabling hand physics
  • Loading branch information
jorgejgnz committed Dec 19, 2020
1 parent 329b679 commit 5aad738
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion Runtime/Helpers/PhysHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,18 @@ public static void SetHandPhysics(ProxyHandModel phModel, bool enabled)
public static void SetBonePhysics(SlaveBoneModel bone, bool enabled)
{
if (bone.rigidbodyRef)
bone.rigidbodyRef.isKinematic = !enabled;
{
if (bone.rigidbodyRef.isKinematic)
{
bone.rigidbodyRef.isKinematic = false;
bone.rigidbodyRef.collisionDetectionMode = CollisionDetectionMode.ContinuousDynamic;
}
else
{
bone.rigidbodyRef.collisionDetectionMode = CollisionDetectionMode.ContinuousSpeculative;
bone.rigidbodyRef.isKinematic = true;
}
}

if (bone.colliderRef)
bone.colliderRef.enabled = enabled;
Expand Down

0 comments on commit 5aad738

Please sign in to comment.