Manual Collision Response

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
Crea
Posts: 10
Joined: Tue Feb 24, 2015 10:54 am

Manual Collision Response

Post by Crea »

Hi there,

I have BEPU integrated into an engine I'm writing, and have recently knocked up a little practice project to test things out.

Is it possible to use BEPU only for collision detection, but provide the response myself? I had assumed this would be trivial, but I'm either confused or it's going to be a little more difficult than thought.

I set up some entities and a static mesh, and detection is fine - my problem comes when I try to use the collision information to formulate a response. I detect collisions, and use the collision location, normal and penetration depth to formulate a response, then I amend the world transform of the physics entity manually to resolve the collision.

What I’d expected was that, on the next frame, no more collision. But what I’m seeing is that the collisions are present (I am polling the collision info on the entity of interest) on the following frames that don’t take account of my manual transformation of the physics entity. I am updating the physics system on every frame.

Can someone help me understand what’s happening here? Is the system simply not designed to be used this way? Must I rely on Bepu’s own collision response if I want response behaviour? Or am I missing some other manual step, say a way to tell Bepu that I’ve handled a particular collision, or to notify it to recalculate collision pairs for a particular entity?

Thanks
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Manual Collision Response

Post by Norbo »

It sounds like something isn't being updated. First guess would be the world transform on the collidable. The EntityCollidable associated with an Entity is the thing that actually gets into collisions, and it has a separate transform from the entity which is normally computed each frame during the entity position update by calling:

Code: Select all

collisionInformation.UpdateWorldTransform(ref position, ref orientation);
So if the default position update phases aren't used and the world transform isn't otherwise updated, the collidable proxy won't move.

Other than that, so long as:
1) the collidables have the proper world transforms and bounding boxes and are added to the broad phase,
2) the broad phase is executed,
3) and broad phase produced pairs are used to maintain and update narrow phase pair handlers (as in the NarrowPhase),
the discrete contacts of the pair handlers should be accurate.
Crea
Posts: 10
Joined: Tue Feb 24, 2015 10:54 am

Re: Manual Collision Response

Post by Crea »

Found what I needed - I set CollisionRules.NoSolver as the default rule. Still get collisions, still get contact info, but the response is left to me.

Thanks!
Post Reply