Page 1 of 1

Entity in Collision

Posted: Fri Aug 10, 2012 7:15 pm
by sazon
HI, again.

How get the Entities in a collision on the event DetectingInitialCollision??

because CollidablePairHandler pair.EntityA and Entity no are accesible level, because are protect.

Re: Entity in Collision

Posted: Fri Aug 10, 2012 7:30 pm
by Norbo
Recent versions of BEPUphysics (v1.2.0+) expose the CollidablePairHandler EntityA and EntityB properties publicly.

Another option: the Collidable parameter of the event handler could be casted to an EntityCollidable. EntityCollidable objects are collision proxies for entities in the collision detection pipeline. If it succeeds, the EntityCollidable.Entity property contains the associated entity. However, just as the pair.EntityA and pair.EntityB properties can be null, the collidable may not be an EntityCollidable. For example, StaticMeshes (and other static objects) are Collidables but not EntityCollidables and so are not associated with entities.

In addition, the BroadPhaseOverlap associated with the pair handler can be used to get the two BroadPhaseEntry objects associated with the pair. Attempting to cast them to an EntityCollidable will find the involved entities.

Re: Entity in Collision

Posted: Fri Aug 10, 2012 8:47 pm
by sazon
oh, thank you very much, I was using version 1.1, attach the new assembly, compile and everything works fine, but there is some document that says the changes between versions

Re: Entity in Collision

Posted: Fri Aug 10, 2012 9:16 pm
by Norbo
The version history shows all the significant changes. A changeset-by-changeset view can be found by looking at the source repository.

Re: Entity in Collision

Posted: Sun Aug 12, 2012 10:11 pm
by sazon
thanks again, another dude, How can access to the point of collision? in a Vector3 value

Re: Entity in Collision

Posted: Sun Aug 12, 2012 10:13 pm
by Norbo
Every CollidablePairHandler has a Contacts property. You can enumerate over, or index into, the contacts collection to find individual contacts in the pair. Every contact provides a position and a variety of other contact-related information.