Manual recovery from penetration problem

Post Reply
Enhex
Posts: 7
Joined: Mon Mar 24, 2014 3:57 pm

Manual recovery from penetration problem

Post by Enhex »

I'm working on a character controller, and it uses manual recovery from penetration which is similar to the one used in the kinematic controller demo - moving back the penetration distance for each contact.

The problem is when there are several contact points at the same direction, the recovery distance gets stacked up and the character gets pushed far too much:
Image

Anyone knows a way to properly handle this problem?
Or perhaps different approach for penetration recovery that works better?
Help would be greatly appreciated.
Ehsanizadi
Posts: 72
Joined: Mon Dec 02, 2013 4:13 pm

Re: Manual recovery from penetration problem

Post by Ehsanizadi »

I think two parameters may affect this behaviour:

1) reducing the time increment
2) increasing the number of iterations of the solver (by default it is set to 20)

Let me know if this work or not.
Enhex
Posts: 7
Joined: Mon Mar 24, 2014 3:57 pm

Re: Manual recovery from penetration problem

Post by Enhex »

Ehsanizadi, that sounds like something that would affect dynamic objects, but not kinematic ones would it?
I did have a go with a dynamic character controller and this problem didn't happen.
But for more advanced controller I need to manually control the movement.
User avatar
drleviathan
Posts: 849
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: Manual recovery from penetration problem

Post by drleviathan »

You could compute the AABB of all penetration vectors and then chose the corner that is furthest from the origin. Dunno if it works but is what I would try if I were doing the same thing.

The AABB combined with the sum of all penetration vectors could provide an even fancier solution. I can imagine scenarios where the AABB extents could be nearly equal along one or two dimensions making it unclear what is really the best direction. The sum of all penetrations could be used to differentiate. For example, you could compute the point where the sum vector leaves the AABB and always use that. I made an image that tries to communicate this: red vectors for all the penetration inputs, blue for their sum, and green for its projection against the AABB of the inputs.

Image
gameover
Posts: 8
Joined: Wed Sep 30, 2015 8:51 pm

Re: Manual recovery from penetration problem

Post by gameover »

Just act on the largest penetration and ignore the others?
Enhex
Posts: 7
Joined: Mon Mar 24, 2014 3:57 pm

Re: Manual recovery from penetration problem

Post by Enhex »

drleviathan wrote:You could compute the AABB of all penetration vectors and then chose the corner that is furthest from the origin. Dunno if it works but is what I would try if I were doing the same thing.

The AABB combined with the sum of all penetration vectors could provide an even fancier solution. I can imagine scenarios where the AABB extents could be nearly equal along one or two dimensions making it unclear what is really the best direction. The sum of all penetrations could be used to differentiate. For example, you could compute the point where the sum vector leaves the AABB and always use that. I made an image that tries to communicate this: red vectors for all the penetration inputs, blue for their sum, and green for its projection against the AABB of the inputs.

Image
Thanks, using corners works.
Using intersection with the sum of penetration isn't a good idea, imagine in my original image having gravity and penetration into the ground - using the intersection with the side of the AABB will only fully recover on the axis of the side's normal.
Using the corner of the AABB on the other hand makes sure you have full recovery on all axes.
gameover wrote:Just act on the largest penetration and ignore the others?
Imagine having penetration from more than 1 direction, like the gravity & ground example I just gave. Only using the largest doesn't guarantee you'll recover from all penetrations.
Post Reply