How to externally identify a Collidable
Posted: Sat Sep 20, 2014 5:35 am
Hi,
My game consists of actors that may contain collision/physics components in the form of BEPU Terrain or Entity objects that participate in the Space simulation. When the actor's game behavior needs to know about collisions that occur inside the simulation, it subscribes to the InitialCollisionDetected event of its Entity. Now the problem I have is that inside this event handler I am given the Collidable object 'other', but what I really want is to take some action on the actor that owns that Collidable, say to deduct health or whatever. What is the best way to do this?
Ideally, I could place an integer actor id on the BroadPhaseEntry object when an actor is initialized with a physics component. Sometimes objects have Tag properties for this purpose, but I found that BEPU doesn't like finding unexpected values in Tag properties or I'm using it incorrectly... I could also maintain a big hashtable of all collidables and their actor ids, but that seems a bit troublesome.
Thanks!!
My game consists of actors that may contain collision/physics components in the form of BEPU Terrain or Entity objects that participate in the Space simulation. When the actor's game behavior needs to know about collisions that occur inside the simulation, it subscribes to the InitialCollisionDetected event of its Entity. Now the problem I have is that inside this event handler I am given the Collidable object 'other', but what I really want is to take some action on the actor that owns that Collidable, say to deduct health or whatever. What is the best way to do this?
Ideally, I could place an integer actor id on the BroadPhaseEntry object when an actor is initialized with a physics component. Sometimes objects have Tag properties for this purpose, but I found that BEPU doesn't like finding unexpected values in Tag properties or I'm using it incorrectly... I could also maintain a big hashtable of all collidables and their actor ids, but that seems a bit troublesome.
Thanks!!