[v1]Disable push between some objects

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
KakCAT
Posts: 32
Joined: Mon Apr 14, 2014 2:08 pm

[v1]Disable push between some objects

Post by KakCAT »

Hi Norbo, sorry for late amount of questions. The more I'm using bepu the more I realize I'm really bad at physics... :(

In V1 I have two bodies that are actually character controllers, let's say A and B. I'd like that A cant' push B at all, and B can't push A at all, however keep A and B working as dynamic objects and keep pushing other objects, falling through ledges, etc... without having to use a kinematic object. Is that possible?

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

Re: [v1]Disable push between some objects

Post by Norbo »

Setting up a collision rule that stops collision detection between the two character controllers would work. They'd just go through each other completely. The CollisionFilteringDemo shows an example of how to use that system.

If you want a different behavior where the characters still collide in some nondynamic sense but cannot push, that would require manual collision resolution to implement the desired arbitrary behavior. You could do this with collision rules too- use the NoSolver rule to allow contacts to be generated, and then examine the collision pair contacts to decide what to do with the collision.

(In v2, there is no 'collision rule' system, just callbacks that permit or deny collision detection and constraint generation. A similar system can be built on top of the callbacks- the RagdollDemo shows one example implementation where connected body parts do not collide based on bitfields.)
KakCAT
Posts: 32
Joined: Mon Apr 14, 2014 2:08 pm

Re: [v1]Disable push between some objects

Post by KakCAT »

Thanks, I'll try with NoSolver path. I suppose the code to handle that nondynamic behaviour must be added after calling Space.Update, isn't it? (I mean, there's no specific callback for that)
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: [v1]Disable push between some objects

Post by Norbo »

Executing it outside the Update would work, but if you implement it as velocity modifications, it may work best before the solver and after collision detection. Every execution stage has a Starting and Finishing event, so you could add a handler to Space.Solver.Starting.
AlexCereus
Posts: 7
Joined: Fri Feb 15, 2019 2:03 pm

Re: [v1]Disable push between some objects

Post by AlexCereus »

Hello. I have similar task for v2. How can I add CollisionRule in v2?
(In v2, there is no 'collision rule' system, just callbacks that permit or deny collision detection and constraint generation. A similar system can be built on top of the callbacks- the RagdollDemo shows one example implementation where connected body parts do not collide based on bitfields.)
Oh, excuse me. Did not see. I will try this first.
Post Reply