lianlab / bullet

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

CcdMotionThreshold confusion in btCollisionObject.h #212

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I observed in btCollisionObject.h that there is confusion over what
m_ccdMotionThreshold is.  Is it the Square or not?

setCcdMotionThreshold sets m_ccdMotionThreshold to the squared value passed
in, but then getCcdMotionThreshold passes out the same value when I would
think it should pass out sqrt(m_ccdMotionThreshold).  Also
getCcdSquareMotionThreshold squares the value again, but It does not need to.

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

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

I noticed the issue in the code on the web at 
http://www.continuousphysics.com/Bullet/BulletFull/btCollisionObject_8h-source.h
tml#l00363

Please provide any additional information below.

I don't know if this will fix the below problem, but I started wondering
about it when I had a fast cube colliding with a plane of triangles, the
object with motion threshold on does hit the plane, but it goes out the
other side instead of bouncing off as I would expect.  If you give the
plane some width (like a flat box) it bounces off just fine.

Proposed change:

00350         btScalar        getCcdMotionThreshold() const
00351         {
00352                 return sqrt(m_ccdMotionThreshold);
00353         }
00354 
00355         btScalar        getCcdSquareMotionThreshold() const
00356         {
00357                 return m_ccdMotionThreshold;
00358         }
00359 
00360 
00361 
00363         void    setCcdMotionThreshold(btScalar ccdMotionThreshold)
00364         {
00365                 m_ccdMotionThreshold =
ccdMotionThreshold*ccdMotionThreshold;
00366         }

Original issue reported on code.google.com by mark.t.c...@gmail.com on 31 Mar 2009 at 11:30

GoogleCodeExporter commented 9 years ago

Thanks for the report.

We should fix this indeed. Not only this member variable issue but also the 
actual 
implementation of the motion clamping and CCD.

Original comment by erwin.coumans on 1 Apr 2009 at 6:38

GoogleCodeExporter commented 9 years ago

The issue has been fixed,

setCcdMotionThreshold(btScalar ccdMotionThreshold)
{
  m_ccdMotionThreshold = ccdMotionThreshold;
}

Thanks Mark!

Original comment by erwin.coumans on 23 May 2009 at 2:34

GoogleCodeExporter commented 9 years ago
Issue 216 has been merged into this issue.

Original comment by erwin.coumans on 23 May 2009 at 2:36