Does jMonkeyEngine has methods that can be used to detect collisions between a sphere and the surfac

I have have spheres that move inside a cube, but I want my program to detect when the spheres hit the walls and then change directions. Do I need to create my own methods to handle that or the Physics engine has some methods that I can use?

Sure physics could detect that. Or you could very quickly (in terms of cpu cycles) test where the sphere is, vs its radius, against the edge of the cube. The key will be to axis-align the cube, so then you just calculate the sphere’s position, plus its radius, and compare that along the x,y,z axes to see if it is inside.

1 Like

did you see

BoundingSphere.intersectsBoundingBox(BoundingBox bb) ?



If you detect the hit, you can calculate angle from sphere direction to a plane representing cube side.

1 Like