Add Collision/trigger to meshInstances

Hello! I want to add collision to my meshInstances in my object in order to execute “something” when they hit a trigger. Is this possible?

I have found out how to add collision and triggers to the object, but they affect all meshInstances as a whole, which is not optimal as I want to change them individually when passing through a trigger.

Do the individual meshInstances animate? If not, you can create multiple trigger/physics objects that are attached to the entity as children and fire an event to the parent when ‘triggered’.

If they do animate, than I would look at doing something similar but updating the position and rotation of the trigger/physics objects to each meshInstance every frame. It’s a bit trickier but still doable.

Thanks! That might actually work. Yes they are animated, but I can figure that part out :slight_smile:

Mesh colliders are pretty expensive, you’d probably be better off using primitives to simulate your mesh.

Also you can use code to parent a collider to a submesh (meshInstance) if you graph that meshInstance’s “node” and use it as the parent. Best way to do that is with something that has a model on it to start with so you can see what is happening. Like a box with a box collider and a box model.

You could clone some entities to use as prefabs for instance, boxes, capsules etc. Or you could use all boxes and just scale them correctly.

Thank you, I’ll try that as well. Will report back to this thread with what worked best in case someone else is looking for an answer to this.