Page 1 of 1

[v1]Disable push between some objects

Posted: Thu Feb 21, 2019 11:29 pm
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!

Re: [v1]Disable push between some objects

Posted: Fri Feb 22, 2019 1:41 am
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.)

Re: [v1]Disable push between some objects

Posted: Fri Feb 22, 2019 11:19 pm
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)

Re: [v1]Disable push between some objects

Posted: Sat Feb 23, 2019 11:42 pm
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.

Re: [v1]Disable push between some objects

Posted: Thu Feb 28, 2019 9:46 am
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.