Hi there!
I just started playing around with bepu and I already have a little problem:-/ I used the Space.RayCast method to cast a "laser" ray. That works pretty well, but I have difficulties to determine which object has been hit. Of course there is the HitObject in the RayCastResult, but I was not able to get the entity of hit object(tried it with casting, but that didn't work). For example I've created a simple Box. How can that box get notified if it gets hit by the raycast?
Thx!!!
Raycast: getting the hit entry
Re: Raycast: getting the hit entry
The BroadPhaseEntry that is contained by the hit information can be cast to an EntityCollidable. An EntityCollidable has an Entity property that contains the owning entity.
Architecturally, the BroadPhaseEntry and its grandchild class EntityCollidable are collision proxies. They live in the collision pipeline (broadphase, narrowphase). The entity uses the pairs and contact information found by this collision proxy to respond physically.
If you find yourself wanting to get the gameplay data associated with an object, note that the Entity has a tag property that can hold any object. Further, in the development version (http://bepuphysics.codeplex.com/SourceC ... evelopment) the BroadPhaseEntry itself has a separate tag property. Using that BroadPhaseEntry tag property can be convenient when dealing with collision events where you don't know that the objects involved are entities.
Architecturally, the BroadPhaseEntry and its grandchild class EntityCollidable are collision proxies. They live in the collision pipeline (broadphase, narrowphase). The entity uses the pairs and contact information found by this collision proxy to respond physically.
If you find yourself wanting to get the gameplay data associated with an object, note that the Entity has a tag property that can hold any object. Further, in the development version (http://bepuphysics.codeplex.com/SourceC ... evelopment) the BroadPhaseEntry itself has a separate tag property. Using that BroadPhaseEntry tag property can be convenient when dealing with collision events where you don't know that the objects involved are entities.
Re: Raycast: getting the hit entry
Thank you very much, that works like a charm! I'm definitively gona have a closer look on your engine, it seems to be very fast and well supported