Entity in Collision

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
sazon
Posts: 15
Joined: Thu Jun 23, 2011 6:07 pm

Entity in Collision

Post 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.
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Entity in Collision

Post 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.
sazon
Posts: 15
Joined: Thu Jun 23, 2011 6:07 pm

Re: Entity in Collision

Post 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
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Entity in Collision

Post by Norbo »

The version history shows all the significant changes. A changeset-by-changeset view can be found by looking at the source repository.
sazon
Posts: 15
Joined: Thu Jun 23, 2011 6:07 pm

Re: Entity in Collision

Post by sazon »

thanks again, another dude, How can access to the point of collision? in a Vector3 value
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Entity in Collision

Post 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.
Post Reply