code-google-com / bullet

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

convexSweepTest against convex shapes fail when distance is <=0.04 #347

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a ridgid body with a box shape
2. Cast a box shape against the rigid body and let the cast distance be
<=0.04. Make sure the cast would hit the rigid body.

What is the expected output? What do you see instead?
- No hit is reported tho there should be a hit 
- If you use a box made out of a mesh for the rigid body the hit will be
reported 
- The behaviour is true for all convex bodies, not only boxes.

What version of the product are you using? On what operating system?
2.76 ,latest trunk. WinXP

Original issue reported on code.google.com by linz...@gmx.de on 26 Feb 2010 at 4:06

GoogleCodeExporter commented 9 years ago
For anyone experiencing this bug here is a wrapper. It just enlarges every cast 
over
0.04 length and adjusts the output values.

float min=0.04;
btVector3 dir=end.getOrigin()-start.getOrigin();
btTransform myEnd=end;
float scaler=1.0;
float len=dir.length();
if (len<min)
{
scaler*=min/len;
myEnd.setOrigin(myEnd.getOrigin()+dir*scaler);
}
bltWorld->convexSweepTest(castShape, start,myEnd, callback,
bltWorld->getDispatchInfo().m_allowedCcdPenetration);

//adjust output
if (callback.m_closestHitFraction<1.0)callback.m_closestHitFraction/=scaler;

Original comment by linz...@gmx.de on 26 Feb 2010 at 4:47

GoogleCodeExporter commented 9 years ago
float min=0.04 is actually to low. it must be >0.04. So 0.05 works.

Original comment by linz...@gmx.de on 28 Feb 2010 at 12:05

GoogleCodeExporter commented 9 years ago
The convexSweepTest seems to have a general problem as soon the distance gets 
small.

A good example is the character controller code. When you remove the
recoverFromPenetration code you will get stuck very quickly into geometry 
because the
stepForwardAndStrafe function can't get you out of collisions when the moving
distance gets too small.

Some quick tests showed that even distances around 0.1 are problematic. The 
issues
seem to get away at distances around 0.25.

Original comment by linz...@gmx.de on 1 Mar 2010 at 2:08

GoogleCodeExporter commented 9 years ago

Thanks for the effort.

Could you create a quick test that shows the problem of the convexSweepTest 
(not 
using the character controller) with a distance between start and stop of 
around 0.1?

Thanks a lot,
Erwin

Original comment by erwin.coumans on 2 Mar 2010 at 8:01

GoogleCodeExporter commented 9 years ago
Hi,

attached is a modified basic demo. 
It shows the effect for convex/convex casts <0.04 that break. 
I'm working on the other example you asked for and upload it later.

Original comment by linz...@gmx.de on 2 Mar 2010 at 10:40

Attachments:

GoogleCodeExporter commented 9 years ago
Oh!  I just noticed this issue.

I analyze the root cause a bit in this post (and ask some questions).  I didn't 
enter an issue myself because I wasn't yet sure if it was a bug or intentional 
behavior:

http://www.bulletphysics.org/Bullet/phpBB3/viewtopic.php?f=9&t=5857&p=20705

For the OP: the case in comment 3 is mostly user error.  You should not remove 
recoverFromPenetration unless you also use 0 allowedCcdPenetration.  However, 
it is still the case that the convex casting code ignores all casts that are 
shorter than allowedCcdPenetration, even if the casts start in penetration (and 
therefore potentially have a max penetration > allowedCcdPenetration)

Original comment by paul.dubois@gmail.com on 4 Nov 2010 at 12:22

GoogleCodeExporter commented 9 years ago
Maybe it's helpful to add that because of issue 451, the symptom in comment 3 
can (currently) only be seen when the world is composed of implicit primitives. 
 It doesn't show up with worlds made up of triangles.

Original comment by paul.dubois@gmail.com on 4 Nov 2010 at 12:24

GoogleCodeExporter commented 9 years ago
Paul: indeed, this was a bug and is fixed here:

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

continuous sweeps would not detect hits unless body0 and body1 penetrate more 
than allowedCcdPenetration. The original poster passes in 0.04, so any sweeps 
shorter than that (and starting from non-penetrating/touching case) would 
report no hits. If this is not desired, set the 'allowedPenetration' to zero.

Original comment by erwin.coumans on 31 Mar 2011 at 9:16