How to check if two Nodes collide

Hi!



I’m trying to make a 3D Tetris game as a way to get to know the engine. I ran into trouble when I tried to use the physics to detect collisions between the blocks. My game is setup so that a class Tetramino (the shapes), which implements Node, has four Blocks (which also implements Node) attached to it. The blocks have a Geometry (Box) attached to them. I added a RigidBodyControl to the Tetramino and use that to translate and rotate it.

When I try to use CollodeWith() with another instance of Tetramino I get an UnsupportedCollisionException. What do I have to do to check for collisions between two nodes? Do I have to add controls to all children nodes as well, and if so do I add them to the bulletAppState separatly or are they added when I add the mother node?

Check the manual on how to do collision detection for physics, just press F1 and enter collision in the search or start here: https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:physics

Thanks, after some reading and looking through the actual method collideWith() I found my error. I thought you could simply check for collisions like this : node1.collideWith(node2, results). But the input arguments are specified as Rays, BoundingVolumes or SweepSpheres. All I had to do to fix my code was to add .getBoundingVolume() to node2.

When you use that kind of collision you dont need physics controls at all.

I am facing “The page does not exist”…any suggestion

That’s because the wiki moved!
You might have a look here: https://jmonkeyengine.github.io/wiki/jme3/advanced/collision_and_intersection.html