rayTest skips collision object when rayTestSingle works fine

obi
Posts: 6
Joined: Tue Aug 16, 2005 9:06 am

rayTest skips collision object when rayTestSingle works fine

Post by obi »

hi,

I'm trying to debug why rayTest will skip certain (Kinematic bodies) collision objects when calling rayTestSingle works perfectly fine on them.
I'm using ClosestRayResultCallback.
At first I thought that it might be collision filter mask, but this type of collision object won't be even considered by needsCollision function...
All those objects collide fine in simulation step, it is just rayTest that is problematic.

Is there something special that I need to be aware of when using ratTest?

--
greetings,
Piotr
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: rayTest skips collision object when rayTestSingle works fine

Post by Erwin Coumans »

I haven't seen this before. Can you reproduce it in one of the Bullet demos, and attach a zipped reproduction case?

Thanks,
Erwin
obi
Posts: 6
Joined: Tue Aug 16, 2005 9:06 am

Re: rayTest skips collision object when rayTestSingle works fine

Post by obi »

I've finally found some time to look into this problem again: it seems that rayTest failed in calcTimeOfImpact function (see callstack below).

Callstack:

Code: Select all

...
btCollisionWorld::rayTest(const btVector3&,const btVector3&,btCollisionWorld::RayResultCallback&) const
btDbvtBroadphase::rayTest(const btVector3&,const btVector3&,btBroadphaseRayCallback&,const btVector3&,const btVector3&)
BroadphaseRayTester::Process(const btDbvtNode*)
btSingleRayCallback::process(const btBroadphaseProxy*)
btCollisionWorld::rayTestSingle(const btTransform&,const btTransform&,btCollisionObject*,const btCollisionShape*,const btTransform&,btCollisionWorld::RayResultCallback&)
btSubsimplexConvexCast::calcTimeOfImpact(const btTransform&,const btTransform&,const btTransform&,const btTransform&,btConvexCast::CastResult&)
It failed on following test:

Code: Select all

//don't report time of impact for motion away from the contact normal (or causes minor penetration)
if (result.m_normal.dot(r)>=-result.m_allowedPenetration)
	return false;
The solution on my end was to change the direction of my ray cast. Is it a bug?
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: rayTest skips collision object when rayTestSingle works fine

Post by Erwin Coumans »

It seems a different issue from the first report (needsCollision is not involved).

Again, can you please share a reproduction case, by modifying any of the demos?

You can attach a zipfile to this forum, or file an issue in the tracker: http://code.google.com/p/bullet/issues/list
Thanks,
Erwin