Shooting a ball "out" of the camera

Apologize if this has been answered a bunch, I did search the forums to no avail.

I need to be able to shoot a ball out of a gun that the player is holding. For my proof-of-concept, however, I just want to be able to shoot a ball in whatever direction the camera is looking.

Can anybody help?

in physics fun i shoot objects just the way you want.

the following method:

  • creates a new object
  • sets the location to the cameras position
  • moves the object a bit in front of the camera
  • adds force to push the object away from the camera

        private void spawnObject() {
                DynamicPhysicsNode node = ObjectFactory.get().createObject();
                node.setName("physics node");
                node.getLocalTranslation().addLocal(cam.getDirection().mult(new Vector3f(2,2,2).add(node.getLocalScale())));
                objectsNode.updateGeometricState(0, false);