CCD motion clamping

Bbilz
Posts: 26
Joined: Wed Feb 27, 2008 9:55 am

CCD motion clamping

Post by Bbilz »

Hi,

Just started testing out the new CCD motion clamping and noticed it doesn't preserve the collision object's collision filters, so it falsely collides with things it should be flagged to avoid.

I made a quick patch to fix this:
ContinuousCollisionFiltersFix.patch.zip
Hope its helpful!
-david
You do not have the required permissions to view the files attached to this post.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: CCD motion clamping

Post by Erwin Coumans »

Patch has been applied, thanks for reporting and the contribution!

http://code.google.com/p/bullet/source/detail?r=1393

Erwin
Bbilz
Posts: 26
Joined: Wed Feb 27, 2008 9:55 am

Re: CCD motion clamping

Post by Bbilz »

Further experimenting brings up what I think are two further problems:

1) When an object activates the CCD, it doesn't seem to have its velocity updated to reflect the clamping. It keeps its high velocity and is then continuously clamped by the CCD, resulting in it appearing to suddenly freeze in place when a fast collision occurs

2) Because the CCD check is done in the middle of the integrate transforms, it can report back a collision with an object that is actually due to be moved, thus clamping against an object that it shouldnt because it is no longer there.

A quick fix for 1) would be to the following inside the CCD clamp:

Code: Select all

    btVector3 linearVelocity;
    btVector3 angularVelocity;

    btTransformUtil::calculateVelocity( body->getWorldTransform(), predictedTrans, timeStep, linearVelocity, angularVelocity );
														
    body->setLinearVelocity( linearVelocity );
    body->setAngularVelocity( angularVelocity );
ie: matching the velocity to the new predictedTrans from the CCD, but I am not sure this is 'correct' physically - it at least stops objects freezing on fast collisions

Not really sure what to do about 2) that doesn't involve changing how the convex sweep works - you kind of want it to know when an object has been properly updated so it could use either the normal world transform, or the predicted world transform..

-david