Content-Length: 4156 | pFad | http://github.com/Unity-Technologies/EntityComponentSystemSamples/pull/277.patch
thub.com
From 87061c6917e770d1e7dc96a852c72b5342622ed0 Mon Sep 17 00:00:00 2001
From: Baptistee
Date: Sat, 28 Oct 2023 18:55:11 +0200
Subject: [PATCH] fixed issue with custom mesh on physics shape auth
Added an else statement after the custom mesh non-null value check.
Otherwise the default rendered mesh is always added in addition with the custom mesh, when there is a mesh filter component on the GO.
---
.../BakingSystems/PhysicsShapeBakingSystem.cs | 48 ++++++++++---------
1 file changed, 25 insertions(+), 23 deletions(-)
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());
}
}
--- a PPN by Garber Painting Akron. With Image Size Reduction included!Fetched URL: http://github.com/Unity-Technologies/EntityComponentSystemSamples/pull/277.patch
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy