The easiest way is to define some collision groups. Objects can only collide, when they are in at least one common group. Every car is in the group vehicles and in the group ground objects . Every airplane is in the group airplanes and in the group air objects . Trees are in ground objects and in trees .
Rocks are in Stones .
So in that example an airplane can t collide with a car, cause they have no common group. Let s say, we have a ghost walking around in our scenery. If we want him let collide with trees and rocks, but not with cars, we put him in the group trees and stones . Putting him only in the group ground objects would let him collide with cars, too. Thus the test if two objects have one common group is simply one bit-AND of the bitfields of the two objects.