Disable collisions between vehicles

Working on my car game project I’d like to know if could be possible to temporarily disable collisions with other vehicle, but not with other scen nodes (track,groud,etc)

thanks in advance

bye

Use the collision groups, the javadoc explains how they work.

normen said:
Use the collision groups, the javadoc explains how they work.

I'll try
thanks for quick answer

how did u solve this problem?

im looking at VehicleControl → removeCollideWithGroup(int collisionGroup)

is this what you used?

but how do we know what collisionGroup the other vehicle belongs to?

@d3ad3n1n: yeah, thats how you remove collision groups. You know what CollisionGroup the other belongs to, because you have to set it somewhere :). All PhysicsCollisionObject start with CollisionGroup01 per default.

d3ad3n1n said:
how did u solve this problem?
im looking at VehicleControl -> removeCollideWithGroup(int collisionGroup)
is this what you used?
but how do we know what collisionGroup the other vehicle belongs to?

Sorry for delayed answer
I add to ground objects all collision groups:
[java]
private void buildTrackCollisionGroups(RigidBodyControl rbc) {
for(int i=0;i<maxCars;i++){
rbc.addCollideWithGroup((int) FastMath.pow(2, (1+i)));
}
}
[/java]
I assign to every vehicle right CollisionGroup
[java]
private void buildCollisionGroups() {
for(int i=0;i<maxCars;i++){
if(player!=null){
player.addCollideWithGroup((int) FastMath.pow(2, (1+i)));
}
}
}
[/java]
then I manage enablingdisabling collisions between vehicles (but not with ground :D )
[java]
private void enableCollisions() {
addCollideWithGroup(PhysicsCollisionObject.COLLISION_GROUP_01);
}
private void disableCollisions() {
removeCollideWithGroup(PhysicsCollisionObject.COLLISION_GROUP_01);
}
[/java]