I’m using a VehicleControl created using a mesh created from a node that contains all the geometries that make up the vehicle. The issue I’m having is that I need to detect collisions between one part of the vehicle (one geometry) and other objects. When I use a PhysicsCollisionListener, it only gives me impacts between the entire vehicle node and other things. How can I make it so that I can detect collisions with just that part of vehicle?
For context, the object I’m talking about is a cylinder that represents a vacuum-like intake to suck up balls, and I need to detect collisions between that cylinder and the balls to collect the balls.
Thanks in advance guys.
Why not just make a separate collision object/listener for that cylinder?
How do I do that? I can’t just make a RigidBodyControl for it because it has to move with the vehicle right? Do I need to make a second node just for the intake and use CollisionShapeFactory.createDynamicMeshShape() for that too, and then combine them using CompoundCollisionShape?
Yes. CompoundCollisionShape is exactly what you need!
Quick update: I wasn’t able to get the collision detection working using the method above, but I was able to implement the game function I needed using a rectangular position filter, using the scalar vector product method found in the second answer of this thread:
https://math.stackexchange.com/questions/190111/how-to-check-if-a-point-is-inside-a-rectangle
Thanks to everyone for the help!