Use Case:
I want the spatial to chase the camera.
I want it to only rotate around the Y axis when chasing the camera.
I want it to rotate to look at the camera but keep its “feet” on the plane.
How do i convert this code so that it stays on the X and Z plane.
spatial.lookAt(this.cam.getLocation(), Vector3f.UNIT_Y);
Vector3f forward = spatial.getLocalRotation().mult(Vector3f.UNIT_Z);
spatial.move(forward.mult(speed*tpf));
Edit: I tried doing it this way and it seems to work , but still wonder if there is a better way.
spatial.lookAt(new Vector3f(this.cam.getLocation().getX(),spatial.getLocalTranslation().getY(), this.cam.getLocation().getZ()), Vector3f.UNIT_Y);