Hi,
I would like to move an object which I pick up with my crosshair. For this I sum up the location vector and the direction vector of the camera. I can pick it up and move it but the problem is that when I click on it it jumps to the location of my cam. Is there a solution for my problem? I want to move it with a predefined distance to my cam.
I tried this to change the position of the object:
Vector3f camPos = cam.getLocation();
Vector3f camDir = cam.getDirection();
Vector3f newPos = new Vector3f();
newPos.setX(camPos.getX() + camDir.getX());
newPos.setY(camPos.getY() + camDir.getY());
newPos.setZ(camPos.getZ() + camDir.getZ());
System.out.println(newPosTestBox.getLocalTranslation().set(newPos);