can i convert an entry to an entity

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
tako.ya
Posts: 3
Joined: Thu Sep 08, 2011 5:44 am

can i convert an entry to an entity

Post by tako.ya »

I'm using the space.reycast, all the objects in my space are entities, but the rayCastResult returns the entry the ray hits. I want to know which entity the ray hits so i can deal with it
Or
Is there any way easy to know which entity the ray hits?
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: can i convert an entry to an entity

Post by Norbo »

Every entity has a CollisionInformation property, which returns an EntityCollidable object. The EntityCollidable object is the entity's proxy in the broad phase and collision detection pipeline. The EntityCollidable is a BroadPhaseEntry.

So, you can attempt to cast the BroadPhaseEntry retrieved from a ray cast to an EntityCollidable. If it succeeds, you can check the EntityCollidable's Entity property to get the entity that owns the collidable.
tako.ya
Posts: 3
Joined: Thu Sep 08, 2011 5:44 am

Re: can i convert an entry to an entity

Post by tako.ya »

thank you, that helps a lot
Post Reply