NewtonCollisionCollideContinue and Penetration

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

NewtonCollisionCollideContinue and Penetration

Postby Crashy » Fri May 27, 2011 5:15 am

Hi,
I'm using NewtonCollisionCollideContinue for collision detection only. Almost everything is working fine but as I'm trying to implement collision response, I have a problem with the penetration values returned by this function.

For the moment I've two boxes(not oriented the same way) intepenetrating, the function returns me 4 contacts points, which is correct, but the penetration of each contact point are always the same and if I'm not wrong this is not true according to the scene configuration. I need the penetration value to get the most penetrating point and calculate the correct impulse to resolve the collision.

Is this a bug or a normal behaviour?
I'm using the latest newton 2.33SDK.
Thanks.
Crashy
 
Posts: 101
Joined: Fri Dec 03, 2010 6:30 am

Re: NewtonCollisionCollideContinue and Penetration

Postby Julio Jerez » Fri May 27, 2011 6:49 am

No it is not a bug, the penetratyion is the worst penetration of all contacts.
as the bodies move away the penetration reduces to zero.

whent bodies penetrate each other, the physic of collision brakes down and not collison impulses theory is the correct theory, instead you need to apply a heuristic to resolve the penetration the best way you can.
The best you can do is to resolve penetation with a smooth function. Exact contact penetation is not a well defined problem.
This only applies when shapes are in deep penetration, as penetration reduces, collision behaves more and more accurding to correct laws of physics.

what Newton does is that it calculates the colliding plane using my wown variance of Minkosky difference. The contacts are the intersection of the two colliding volumes with that plane,
and the penetration for all contacts is the average distance from the first contact point to the colliding plane as calculated by the minskowsky difference of the two shapes.
This penetation would be the closest distance of the minskosky convex shape to the origin.
this penetration is a continue and smooth function that goes from zero when the two shapes touch, to a positive value when they are penetrating, and a negative value when they are disjoin.
this always lead to smooth contact behavior when they are used in contact resolution.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonCollisionCollideContinue and Penetration

Postby Crashy » Fri May 27, 2011 8:07 am

Thanks for the answer:)

Finally what I did is to get a kind of barycenter of all contact points and it gives quite good results :).
Crashy
 
Posts: 101
Joined: Fri Dec 03, 2010 6:30 am

Re: NewtonCollisionCollideContinue and Penetration

Postby Julio Jerez » Fri May 27, 2011 8:55 am

That will work, the contacts fo two simple convex shape will alway be a convex polygon,

are you using only one contact?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonCollisionCollideContinue and Penetration

Postby Crashy » Wed Jun 01, 2011 2:40 pm

are you using only one contact?

I'm afraid I dont understand what do you mean.

By the way what is the right use and meaning of parameters timestep and timeOfImpact? The source code of collideContinue related to them is a bit confusing.

Does timestep means the current's frame delta time? If so timeOfImpact is a value between 0 and 1 or between 0 and timeStep? I need it to have a good estimation of the position of my objects when the collision occurs.
Thanks.
Crashy
 
Posts: 101
Joined: Fri Dec 03, 2010 6:30 am


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron