Multiple Collision Groups

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
trillium
Posts: 2
Joined: Tue Jan 28, 2014 9:50 pm

Multiple Collision Groups

Post by trillium »

I am currently trying to implement a system where I can have two separate collision groups.
Say I have two objects, A and B, and a character entity C.
Objects A and B would have an outer mesh in collision group 1 (blue in image).
Objects A and B would also have an inner mesh belonging to collision group 2 (red in image).

The outer meshes would be able to collide with each other and collisions would be solved normally.

I'd like character object C to be able to be pushed around by the inner meshes of A and B, but I do not want the character to be able to affect the other objects. Basically, object A and B should only react when the outer meshes collide with each other, not their inner meshes colliding with C.

For example, in the picture below, I'd like it so that if A was given a LinearVelocity to push it to the right, it could push C off the little ledge without slowing down.
Image

I've tried to do some things with compound bodies and making things dynamic/kinetic, but so far have not been able to create something that works the way I'd like. Any idea how this could be done?

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

Re: Multiple Collision Groups

Post by Norbo »

One option would be to make objects A and B actually two objects each. The outer object would be dynamic and its collision rules would be set to collide with other outer objects, but not the character. The inner object would be kinematic and its collision rules would be set to collide with the character. The inner objects' positions and velocities would then be set each frame to follow the outer objects' dynamic motion.

Another option would be to use only one object for each of the pieces, but make their masses very large in comparison to the character. Collisions between the objects will behave normally, but the character will tend to get shoved helplessly. Technically, the object will still be affected by the character collision, but only a small amount.

Depending on the demands of the simulation, other options might be possible. For example, if this was some sort of contraption, motors could be used to control the motion of the large objects such that the character would get shoved around. The objects would respond to the collision, but the motors would work to ensure that the objects get their job done.
Post Reply