Hello,
Is there something like callback functions in entitys which get called if some other entity collides with it? It would be easy way to determine which entitys collided, or is there a better way to determine that?
Callbacks
Re: Callbacks
You can hook events to individual entities using the (Entity).addEventHook method. There are quite a few options to choose from, including events that fire when objects come close to each other, when they initially collide, and when they stop colliding.
If you want something more general without using events, like the ability to check all colliding pairs, you can iterate over the (Space).controllers list. These represent entity pairs which are candidates for collision. You can check if they are currently colliding by their current number of contacts (more than 0 means colliding).
If you want something more general without using events, like the ability to check all colliding pairs, you can iterate over the (Space).controllers list. These represent entity pairs which are candidates for collision. You can check if they are currently colliding by their current number of contacts (more than 0 means colliding).
Re: Callbacks
Oh yeah like that fish and barrel example. Thanks Norbo! Just started using bepu physics and it seems to be brilliant system