diff --git a/PhysicsSamples/Assets/Samples/Unity Physics/1.0.10/Custom Physics Authoring/Unity.Physics.Custom/Bodies/BakingSystems/PhysicsShapeBakingSystem.cs b/PhysicsSamples/Assets/Samples/Unity Physics/1.0.10/Custom Physics Authoring/Unity.Physics.Custom/Bodies/BakingSystems/PhysicsShapeBakingSystem.cs index 2d01090a9..d737c8665 100644 --- a/PhysicsSamples/Assets/Samples/Unity Physics/1.0.10/Custom Physics Authoring/Unity.Physics.Custom/Bodies/BakingSystems/PhysicsShapeBakingSystem.cs +++ b/PhysicsSamples/Assets/Samples/Unity Physics/1.0.10/Custom Physics Authoring/Unity.Physics.Custom/Bodies/BakingSystems/PhysicsShapeBakingSystem.cs @@ -171,33 +171,35 @@ bool GetMeshes(PhysicsShapeAuthoring shape, out List meshes, o meshes.Add(shape.CustomMesh); childrenToShape.Add(float4x4.identity); } - - // Try to get all the meshes in the children - var meshFilters = GetComponentsInChildren(); - - foreach (var meshFilter in meshFilters) + else { - if (meshFilter != null && meshFilter.sharedMesh != null) + // Try to get all the meshes in the children + var meshFilters = GetComponentsInChildren(); + + foreach (var meshFilter in meshFilters) { - var shapeAuthoring = GetComponent(meshFilter); - if (shapeAuthoring != null && shapeAuthoring != shape) - { - // Skip this case, since it will be treated independently - continue; - } - - meshes.Add(meshFilter.sharedMesh); - - // Don't calculate the children to shape if not needed, to avoid approximation that could prevent collider to be shared - if (shape.transform.localToWorldMatrix.Equals(meshFilter.transform.localToWorldMatrix)) - childrenToShape.Add(float4x4.identity); - else + if (meshFilter != null && meshFilter.sharedMesh != null) { - var transform = math.mul(shape.transform.worldToLocalMatrix, meshFilter.transform.localToWorldMatrix); - childrenToShape.Add(transform); + var shapeAuthoring = GetComponent(meshFilter); + if (shapeAuthoring != null && shapeAuthoring != shape) + { + // Skip this case, since it will be treated independently + continue; + } + + meshes.Add(meshFilter.sharedMesh); + + // Don't calculate the children to shape if not needed, to avoid approximation that could prevent collider to be shared + if (shape.transform.localToWorldMatrix.Equals(meshFilter.transform.localToWorldMatrix)) + childrenToShape.Add(float4x4.identity); + else + { + var transform = math.mul(shape.transform.worldToLocalMatrix, meshFilter.transform.localToWorldMatrix); + childrenToShape.Add(transform); + } + + DependsOn(meshes.Last()); } - - DependsOn(meshes.Last()); } } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy