Page 1 of 1
Manual recovery from penetration problem
Posted: Wed Sep 30, 2015 2:35 am
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:
Anyone knows a way to properly handle this problem?
Or perhaps different approach for penetration recovery that works better?
Help would be greatly appreciated.
Re: Manual recovery from penetration problem
Posted: Wed Sep 30, 2015 8:29 am
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.
Re: Manual recovery from penetration problem
Posted: Wed Sep 30, 2015 2:25 pm
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.
Re: Manual recovery from penetration problem
Posted: Wed Sep 30, 2015 4:51 pm
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.

Re: Manual recovery from penetration problem
Posted: Wed Sep 30, 2015 8:57 pm
by gameover
Just act on the largest penetration and ignore the others?
Re: Manual recovery from penetration problem
Posted: Sat Oct 03, 2015 3:40 am
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.

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.