Page 1 of 1
Path finder with collision detection
Posted: Sat Dec 17, 2011 11:32 pm
by emmo30
Hi, I would like doing a pathfinder system for my unit moving, but i can't get information of another collidable object.
can u say me how method return object info in space.
thanks, Emre
Re: Path finder with collision detection
Posted: Sun Dec 18, 2011 1:48 am
by Norbo
I'm not quite sure what specific information you're looking for, so here's a few possibilities.
If you're looking for information about collisions between objects, then you can use collision events (
http://bepuphysics.codeplex.com/wikipag ... umentation). There are a variety of callbacks which tell you about contact points and collision pairs.
If you want collision information but without using events, you can also check out the entity.CollisionInformation.Pairs collection. Each pair has a Contacts collection which contains all contacts created by the pair as well as other information like normal force and relative velocity.
If you want to query the space for possible collisions in a volume, you can use the Space.BroadPhase.QueryAccelerator. It supports ray casts and other bounding volume tests. It returns a set of BroadPhaseEntry objects. The Entity.CollisionInformation property returns a BroadPhaseEntry. So, if you use the query accelerator to find a bunch of broad phase entries, you can determine if they belong to an entity by attempting to cast them to an EntityCollidable. Another option is to put some data into the Tag property of the collision information. Note that the Entity.Tag and Entity.CollisionInformation.Tag are separate fields.