public void Execute() { Result[0] = HashableShapeInputs.GetHash128( ForceUniqueIdentifier, GenerationParameters, Material, CollisionFilter, BakeFromShape, Inputs, AllSkinIndices, AllBlendShapeWeights ); }
internal override ShapeComputationData GenerateComputationData( LegacyMesh shape, ColliderInstance colliderInstance, NativeList <float3> allConvexHullPoints, NativeList <float3> allMeshVertices, NativeList <int3> allMeshTriangles, HashSet <UnityEngine.Mesh> meshAssets ) { if (shape.sharedMesh == null) { throw new InvalidOperationException( $"No {nameof(LegacyMesh.sharedMesh)} assigned to {typeof(MeshCollider)} on {shape.name}." ); } if (!shape.sharedMesh.IsValidForConversion(shape.gameObject)) { throw new InvalidOperationException( $"Mesh '{shape.sharedMesh}' assigned to {typeof(MeshCollider)} on {shape.name} is not readable. Ensure that you have enabled Read/Write on its import settings." ); } meshAssets.Add(shape.sharedMesh); var res = base.GenerateComputationData(shape, colliderInstance, allConvexHullPoints, allMeshVertices, allMeshTriangles, meshAssets); if (shape.convex) { res.ShapeType = ShapeType.ConvexHull; res.ConvexHullProperties.Material = res.Material; res.ConvexHullProperties.Filter = res.CollisionFilter; res.ConvexHullProperties.GenerationParameters = ConvexHullGenerationParameters.Default; } else { res.ShapeType = ShapeType.Mesh; res.MeshProperties.Material = res.Material; res.MeshProperties.Filter = res.CollisionFilter; res.ConvexHullProperties.GenerationParameters = default; } var transform = shape.transform; var rigidBodyTransform = Math.DecomposeRigidBodyTransform(transform.localToWorldMatrix); var bakeFromShape = math.mul(math.inverse(new float4x4(rigidBodyTransform)), transform.localToWorldMatrix); res.Instance.Hash = HashableShapeInputs.GetHash128( 0u, res.ConvexHullProperties.GenerationParameters, res.Material, res.CollisionFilter, bakeFromShape, new NativeArray <HashableShapeInputs>(1, Allocator.Temp) { [0] = HashableShapeInputs.FromMesh(shape.sharedMesh, float4x4.identity) },