code-google-com / bullet

Automatically exported from code.google.com/p/bullet
0 stars 0 forks source link

Incorrect Velocity-Clamping on Impact with CCD enabled #356

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a rigid-body Sphere and a Static Mesh (btTriangleMesh)
2. Enable continuous collision for the sphere
3. Apply forces to move the sphere at high speeds (say 100 m/sec)
4. let the sphere collide with the mesh, it will properly collide with it,
but get stuck for a few frames and not move at all, then it suddenly
bounces away from the mesh, as it should have done immediately

What is the expected output? What do you see instead?

Expected: Immediate response, no lag of several frames.

What version of the product are you using? On what operating system?

Bullet 2.75 and 2.76
Windows and Linux

Please provide any additional information below.

Forum posts that describe it in more detail:
http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?p=17657#p17657
http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?p=16885#p16885

Original issue reported on code.google.com by Jan.Kras...@gmail.com on 5 Mar 2010 at 6:05

GoogleCodeExporter commented 9 years ago
I've found some similar artifacts with playing with the CCD with rag dolls. I 
think the issues I'm experiencing might be related to some short comings in the 
CCD system, so not sure if I should add a new issue for this or just mention it 
here.

In my case, I'm creating a rag doll rig (same as the ragdoll demo), then 
dropping him over some static collision from very high. With CCD off on the 
body parts, he falls fine but of course the smaller pieces of the rag doll will 
penetrate through the ground collision. With CCD on he collides with the ground 
properly, but when falling he begins to break up as the speed increases and 
often pieces of his limbs get detached and end up floating in the sky. The 
limbs staying stuck in the sky could be due to velocity clamping problems. 

However I'm pretty sure the breaking up and subsequent limb detaching is 
related to how the btDiscreteDynamicsWorld::integrateTransforms function does 
one more CCD pass before applying the predictedTransform. This last pass of CCD 
(its done once before in the addSpeculativeContacts func) applies collision 
responce without any respect to constraints. So in my case I'm getting a series 
of bodyparts colliding with each other during the fall in this func. If I 
comment out all of the CCD code from the integrateTransforms func the problem 
goes away. Occasionally though the first CCD pass isn't enough and my rag doll 
will have the odd limb penetrate the ground collision, but it most of the time 
it lands ok and the falling artifacts are gone with this change.

Original comment by cont...@vicariousentertainment.com on 17 Sep 2011 at 2:04

GoogleCodeExporter commented 9 years ago
So I posted this minutes after 2.79 was released it appears. The new release 
elimantes the addSpeculativeContacts func call instead of what I did, and 
retains the CCD code in integrateTransforms.

I didn't take 2.79, but I switched internalSingleStepSimulation to mirror the 
2.79 release with the addSpeculativeContacts call commented out and the full 
integrateTransforms func reenabled. This doesn't work as well as my solution. I 
still loose bodyparts when I drop my rag doll and get a little break up here 
and there. I'll just run 2.78 modified for now till a better solution comes 
along.

Original comment by cont...@vicariousentertainment.com on 17 Sep 2011 at 2:31

GoogleCodeExporter commented 9 years ago
It is possible to re-introduce the speculativd contacts and leave it disabled 
by default.

Can you try to add your solutions as a patch to 2.79, with a small ragdoll demo?

Original comment by erwin.coumans on 17 Sep 2011 at 5:13

GoogleCodeExporter commented 9 years ago
Well like I said I think a better solution is needed, I'm not sure if my hack 
will cause more problems for others then it would solve. I'm not even sure the 
original poster's problem is entirely related. My fix got rid of the artifacts 
high speed falling ragdolls were exhibiting in my game, but it comes at the 
expense of comprimising the CCD system. That sacrifice would be unacceptable 
for alot of types of games (ones with high speed RB projectiles without 
attached constraints for instance).

I'm a little busy trying to finish up our prototype right now but when I find 
some time I can modify the out of the box rag doll demo to expose these 
artifacts if you like and send it to you.

Original comment by cont...@vicariousentertainment.com on 19 Sep 2011 at 10:01

GoogleCodeExporter commented 9 years ago
Just saw this bug report and in case anybody is interested, the same behavior 
is in 2.79 shooting the box generated by pressing . in the DemoApplication 
class code. That box has a CCD-sphere enabled, and when I shoot that at a 
compound shape in my test-code, the box in some cases get stuck on the compound 
surface, then it moves a bit, then it bounces away after a lag of like 10-30 
frames (sometimes it gets stuck forever).

Disabling the ccd-sphere function calls for the boxes fixes the problem.

I put a video showing the problem on youtube:

http://www.youtube.com/watch?v=Q17MnAMujTI

The compound it gets stuck on is just 10 boxes.

Original comment by bjorn.we...@gmail.com on 7 Jan 2012 at 4:16

GoogleCodeExporter commented 9 years ago
Yeah hopefully these CCD issues can get addressed in the next update. I 
absolutly need to find a proper solution to this problem before my company's 
game comes out this year. I did get a chance to modify the Bullet ragdoll demo 
to exhibt the problems we're having with falling ragdolls in our title. Mostly 
I just needed to enable CCD, but theres a few other tweaks in there too to make 
it demo better. Just throw a rag doll off the platform and you should see the 
same issues we have.

Original comment by cont...@vicariousentertainment.com on 7 Jan 2012 at 7:10

Attachments:

GoogleCodeExporter commented 9 years ago
Erwin, do you think the issue I'm reporting with the Rag Dolls is the same as 
the ones reported by others in this thread? I can create a new issue with my 
ragdoll sample code if you like. To date this is the biggest tech problem 
remaining in our game and we releasing this year. There should be time to take 
one more version of bullet after 2.80 (which we should be adopting in about a 
week).

Original comment by cont...@vicariousentertainment.com on 7 Mar 2012 at 2:54

GoogleCodeExporter commented 9 years ago
I still plan into looking into this soon.

Original comment by erwin.coumans on 12 Mar 2012 at 8:40

GoogleCodeExporter commented 9 years ago
I've hit similar issues with CCD. Attached is a small diff for the 
CcdPhysicsDemo which replicates what I think is the same issue. When firing 
boxes at the 1st line of static boxes on the ground often the fired boxes will 
bounce off at extreme speeds. This results in an issue when firing a box 
straight on at the 2nd line of boxes on the ground. The box will instantly jump 
back and forth and then stick, also giving an "Overflow in AABB, object removed 
from simulation" error. 

Original comment by will.thi...@googlemail.com on 26 Mar 2012 at 8:02

Attachments:

GoogleCodeExporter commented 9 years ago
The issue should be fixed in latest trunk.
https://code.google.com/p/bullet/source/detail?r=2570

Now there are predictive contacts that are handled by the constraint solver. 
The ccd motion clamping code is still active, as a safety gap: if the motion of 
the fast moving object is changed by the solver, we might miss collisions 
otherwise.

Original comment by erwin.coumans on 11 Sep 2012 at 3:14

GoogleCodeExporter commented 9 years ago
Excellent! Looking forward to 2.81!

Original comment by cont...@vicariousentertainment.com on 11 Sep 2012 at 3:24