Hi,
I would like to set a trigger collider to my entity via script. I create a capsule collider with it’s geometry and filter but now I want to assign also the material
BlobAssetReference<Unity.Physics.Collider> collider = Unity.Physics.CapsuleCollider.Create( capsuleGeometry, filter, material);
The material I want to create and assign must have the flag trigger but when I try to do that I get the error Material.MaterialFlags is inaccessible. So how can i handle it?
Thank you
Just set Material.CollisionResponse = CollisionResponsePolicy.RaiseTriggerEvents, it will handle those flags internally.
Hi, thank you for your help. This solved the issue.
Do you know if it is possible to add two collider to the same entity? I tried with add componentData() but it seem to add only the second one
You can only add one PhysicsCollider component to an Entity, however you can create a CompoundCollider made up from a number of other convex Colliders.
Hi, Thank you for your answer. This is just for 2D Entities or also for Entities in general? I can’t find documentation on it
It’s for all Entities. Entity can have a maximum of 1 PhysicsCollider component.
Thank you mates, I solved all my issues. I ended up with instantiating an entity with a trigger collider as child of another entity setting up the main entity as parent and synchronizing their matrix
1 Like