Hi,
I'm a bit new to all this so apologies in advance!
I'm using BroadPhase.QueryAccelerator.GetEntries() to get a list of broad phase entries within a bounding volume.
How can I get the entity with which the volume overlaps from the broad phase entry?
Cheers
Getting entity from a broadphase entry.
Re: Getting entity from a broadphase entry.
Ah don't worry - I set the tag of the collision information object. Perfect
Re: Getting entity from a broadphase entry.
That is indeed one way to do it. Sticking some game logic object in the tag is useful to bind everything together too.Ah don't worry - I set the tag of the collision information object. Perfect
Another way is to check to see if the BroadPhaseEntry is an EntityCollidable. The organization goes like this:
-A BroadPhaseEntry lives in the BroadPhase and collision detection pipeline.
-The Collidable class inherits from BroadPhaseEntry. Collidables are capable of generating contacts between each other. Examples of concrete objects which inherit Collidable include Terrain, StaticMesh, and InstancedMesh.
-The EntityCollidable class also inherits from Collidable. Entities use EntityCollidables as collision proxies in the collision detection pipeline. An entity's EntityCollidable is stored in the entity.CollisionInformation property. An EntityCollidable has an Entity property which references the Entity which owns it.
So, the tagless method would be:
-Attempt a cast from a BroadPhaseEntry to EntityCollidable.
-If it succeeds, check the Entity property of the EntityCollidable object.