#Mesh data from PhysicsCollider

1 messages · Page 1 of 1 (latest)

languid briar
#

Hello, how can I retrieve the raw mesh data used for a physics collider? Is the answer any different in 0.51 and 1.0?

dry ravine
#

I think I know I saved this code from when a dev had a similar question before

#
 Entities    
            .WithName("ChangeColliderFilterJob")    
            .WithoutBurst()    
            .WithStructuralChanges()
            //.WithNativeDisableUnsafePtrRestriction()
            .ForEach((ref PhysicsCollider collider) =>            
            {
        
                collider.Value.Value.SetCollisionFilter(new CollisionFilter        
                {            
                    BelongsTo = 0,            
                    CollidesWith = 0
        
                });
                 
                Unity.Physics.CapsuleCollider * capsuleCollider = (Unity.Physics.CapsuleCollider*)collider.ColliderPtr;//TODO A way to change the radius of a collider
                var capsuleGeometry = capsuleCollider->Geometry;
                capsuleGeometry.Radius = 1f;
                capsuleCollider->Geometry = capsuleGeometry;


            }).Run();```
#

not sure if that's exactly what you are after though