Pointing the camera in the shooting direction

I’m making a pool game and I’m trying to point the camera in the shooting direction so you can see where you shoot at.

However I can’t get the camera looking in the right direction. I have read the 3d math tutorial, but I’m still a little bit lost with the 3d math. This is my code:

//Place the camera behind the ball Quaternion camRotation = new Quaternion(); camRotation.fromAngles(shootingDirection.x, shootingDirection.y, shootingDirection.z);
    camLocation = ballList[0].getSpatial().getLocalTranslation();

Thanks in advance.

Try to use cam.lookAt(shootingDirection, Vertor3f.UNIT_Y);