Skip to content

Commit

Permalink
Fix allowCollision SDK compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreadrith committed Apr 10, 2023
1 parent f9df95b commit 7fb94ee
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion Runtime/Scripts/DescriptorCollidersSendersHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,27 @@ public static void ExtractDescriptorColliders(VRCAvatarDescriptor descriptor, De
}

List<VRCPhysBoneCollider> createdColliders = new List<VRCPhysBoneCollider>();
var collidingBones = descriptor.GetComponentsInChildren<VRCPhysBone>().Where(p => 0 != (int)p.allowCollision);
var collidingBones = descriptor.GetComponentsInChildren<VRCPhysBone>().Where(p =>
{
using (var so = new SerializedObject(p))
{
var allowCollision = so.FindProperty("allowCollision");
if (allowCollision.propertyType == SerializedPropertyType.Boolean)
return allowCollision.boolValue;

switch (allowCollision.enumValueIndex)
{
default: return false;
case 1: return true;
case 2:
{
var collisionFilter = so.FindProperty("collisionFilter");
return collisionFilter.FindPropertyRelative("allowSelf").boolValue;
}
}

}
});

void ExtractCollider(VRCAvatarDescriptor.ColliderConfig config, HumanBodyBones matchedBone, string collisionName, bool isSenderOnly = false)
{
Expand Down

0 comments on commit 7fb94ee

Please sign in to comment.