Page 1 of 1

issue with raycast vehicle and collision filtering (mask)

Posted: Wed Sep 08, 2010 8:11 am
by gjaegy
Hi,

I have added some collision filtering to the engine, in order to avoid some collision between trees and terrain.

So, I use two groups:

world: 0x0001
entities: 0x0010

I create the world collision shapes as follow (they can only collide with the entities):
group : 0x0001
mask : 0x0010

I create the entities as follow (they can collide with the world and with the other entities):
group: 0x0010
mask: 0x0010 | 0x0001 = 0x0011

Now, when I add a btRayCastVehicle using the entities scheme (which should collide with both the world and the other entities), the wheels are not colliding with the ground anymore (the fall through the ground), while the chassis shape still collides with the ground.

Therefore, I would think that the ray trace operation doesn't use the group/mask properly.

Has anybody experienced a similar issue ?

Thanks for your help !!

Re: issue with raycast vehicle and collision filtering (mask

Posted: Wed Sep 08, 2010 8:45 am
by gjaegy
I think the issue comes from the following line:

btRaycastVehicle.cpp

Code: Select all

void* btDefaultVehicleRaycaster::castRay(const btVector3& from,const btVector3& to, btVehicleRaycasterResult& result)
{
//	RayResultCallback& resultCallback;

	btCollisionWorld::ClosestRayResultCallback rayCallback(from,to);
rayCallback group/mask are not initiliazed according to the vehicle group/mask, but the group is automatically set to 1.

Therefore, the following test returns false:

btCollisionWorld.h
virtual bool needsCollision(btBroadphaseProxy* proxy0) const

Code: Select all

collides = collides && (m_collisionFilterGroup & proxy0->m_collisionFilterMask);
Any idea how I can fix this ?

thanks,
Greg

Re: issue with raycast vehicle and collision filtering (mask

Posted: Thu Sep 09, 2010 11:48 am
by Flix

Re: issue with raycast vehicle and collision filtering (mask

Posted: Thu Sep 09, 2010 12:31 pm
by gjaegy
Yes, this should do the job. Thanks a lot !

Question for Erwin: what about adding these changes to the main trunk, as this appear to be a bug to me ?