Hi! I'm making a quick and dirty FPS like game, and I'm using Bepu to ru nthe physics of the game.
There is a way to use Bepu to find all entities that are inside a Sphere ? Could be usefull to advice the actors attached to these entitys and give damage by a explosion.
Getting all entitys inside a sphere
Re: Getting all entitys inside a sphere
The broad phase supports queries:
'listOfResults' will contain the set of BroadPhaseEntry objects whose bounding boxes touched the given bounding sphere.
A BroadPhaseEntry is something that lives inside the broad phase. Entity objects do not directly inherit from BroadPhaseEntry; instead, they have a collision proxy stored in the Entity.CollisionInformation property of type EntityCollidable which inherits from Collidable which inherits from BroadPhaseEntry.
So, to determine if a BroadPhaseEntry is associated with an Entity, try to cast the BroadPhaseEntry to an EntityCollidable. If it succeeds, use the EntityCollidable.Entity property to get the entity.
Another option is to store a game logic object in the BroadPhaseEntry.Tag property that stores whatever helpful information you want and access that directly.
Code: Select all
Space.BroadPhase.QueryAccelerator.GetEntries(boundingSphere, listOfResults);
A BroadPhaseEntry is something that lives inside the broad phase. Entity objects do not directly inherit from BroadPhaseEntry; instead, they have a collision proxy stored in the Entity.CollisionInformation property of type EntityCollidable which inherits from Collidable which inherits from BroadPhaseEntry.
So, to determine if a BroadPhaseEntry is associated with an Entity, try to cast the BroadPhaseEntry to an EntityCollidable. If it succeeds, use the EntityCollidable.Entity property to get the entity.
Another option is to store a game logic object in the BroadPhaseEntry.Tag property that stores whatever helpful information you want and access that directly.