public Location getRelativeInFacingDirection(double distance) { //TODO: Add in Parent look matrix double pitch = this.getPitch(); double yaw = this.getYaw(); while (pitch > 360) { pitch -= 360; } while (pitch < 0) { pitch += 360; } while (yaw > 360) { yaw -= 360; } while (yaw < 0) { yaw += 360; } pitch = MathUtils.toRadians(pitch + 0.00001); yaw = MathUtils.toRadians(yaw + 0.00001); double adjacent = Math.Cos(pitch) * distance; double opposite = Math.Tan(pitch) * adjacent; double z = (Math.Cos(yaw) * adjacent); double x = Math.Tan(yaw) * z; Location t = this.getAbsoluteLocation(); t.addX(x); t.addY(-opposite); t.addZ(z); return(t); }