Hi all. Could anyone explain how I can use setLinearVelocity to push a ball forward? I have the following code which creates and positions a cannon ball ballPlayer in front of a spatial avatarPlayer by 1.8f and above it by 1.8f. In the final line I try to push the ball forward in the direction the ball is facing, but seems the ball is not pushed forward but in some other direction. Any help is greatly appreciated!
ballPlayer = new Geometry(“cannon ball”, sphere);
ballPlayer.setMaterial(stone_mat);
rootNode.attachChild(ballPlayer);
ballPlayer.setLocalTranslation(avatarPlayer.localToWorld(new Vector3f(0, 0, 1.8f), null).add(0, 1.8f, 0)); // positions the ball relative to the
ball_phy = new RigidBodyControl(1f);
ballPlayer.addControl(ball_phy);
bulletAppState.getPhysicsSpace().add(ball_phy);
ball_phy.setLinearVelocity(ballPlayer.localToWorld(new Vector3f(0, 0, 1f), null)); // push the ball foward