I’m going to make this clear from the outset. I’m not a jMonkey wizard. I just downloaded the sdk a few days ago and I’m working on a school project using the engine. I’m going to try and make the issue I am having as clear as possible
I have a simple scene with a wall, a ball, and a tennis racket. Here’s a picture:
I have a key wired to make the ball start moving towards the wall when I push it. I have CollisionShapes around both the wall and the ball. I want the ball to stop moving when it touches the wall.
The ball always goes through the wall even though I have collision around both. Now, I have bulletAppState.setDebugEnabled(); set to true. I can see the collision boxes.
You can see that the collision box around the ball is not moving with the ball. I do not understand why this is happening. I have the collision box attached to the Spatial representing the ball written this way:
CollisionShape wallShape = CollisionShapeFactory.createBoxShape(wall);
wallCollision = new RigidBodyControl(wallShape, 0);
//ball CollisionShape ballShape = CollisionShapeFactory.createBoxShape(ball); ballCollision = new RigidBodyControl(ballShape, 0); ball.addControl(ballCollision);
But still, the collision box does not move with the ball. Is there something here that I’m missing? Here’s the full code: