Skip to content

Commit

Permalink
fix: additional cases where reinit is needed for PB components
Browse files Browse the repository at this point in the history
  • Loading branch information
bdunderscore committed May 12, 2024
1 parent 3126c4f commit 5f283af
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Editor/VRChat/ForceReinitPhysBonesHook.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#region

using UnityEngine;
using VRC.Dynamics;
using VRC.SDK3.Dynamics.Contact.Components;
using VRC.SDK3.Dynamics.PhysBone.Components;
using VRC.SDKBase.Editor.BuildPipeline;

Expand All @@ -27,6 +29,17 @@ public bool OnPreprocessAvatar(GameObject avatarGameObject)
physBone.InitTransforms(true);
physBone.InitParameters();
}

foreach (var collider in avatarGameObject.GetComponentsInChildren<VRCPhysBoneColliderBase>(true))
{
collider.UpdateShape();
}

foreach (var contact in avatarGameObject.GetComponentsInChildren<ContactBase>(true))
{
contact.UpdateShape();
contact.UpdateContact();
}
}

return true;
Expand Down

0 comments on commit 5f283af

Please sign in to comment.