issue with raycast vehicle and collision filtering (mask)

Post Reply
gjaegy
Posts: 178
Joined: Fri Apr 18, 2008 2:20 pm

issue with raycast vehicle and collision filtering (mask)

Post 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 !!
gjaegy
Posts: 178
Joined: Fri Apr 18, 2008 2:20 pm

Re: issue with raycast vehicle and collision filtering (mask

Post 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
Flix
Posts: 456
Joined: Tue Dec 25, 2007 1:06 pm

Re: issue with raycast vehicle and collision filtering (mask

Post by Flix »

gjaegy
Posts: 178
Joined: Fri Apr 18, 2008 2:20 pm

Re: issue with raycast vehicle and collision filtering (mask

Post 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 ?
Post Reply