Gets a unit-vector pointing in the direction that this Location is facing. @return a vector pointing the direction of this location's #getPitch() pitch and #getYaw() yaw
()
| 283 | * #getPitch() pitch} and {@link #getYaw() yaw} |
| 284 | */ |
| 285 | @NotNull |
| 286 | public Vector getDirection() { |
| 287 | Vector vector = new Vector(); |
| 288 | |
| 289 | double rotX = this.getYaw(); |
| 290 | double rotY = this.getPitch(); |
| 291 | |
| 292 | vector.setY(-Math.sin(Math.toRadians(rotY))); |
| 293 | |
| 294 | double xz = Math.cos(Math.toRadians(rotY)); |
| 295 | |
| 296 | vector.setX(-xz * Math.sin(Math.toRadians(rotX))); |
| 297 | vector.setZ(xz * Math.cos(Math.toRadians(rotX))); |
| 298 | |
| 299 | return vector; |
| 300 | } |
| 301 | |
| 302 | /** |
| 303 | * Sets the {@link #getYaw() yaw} and {@link #getPitch() pitch} to point |
no test coverage detected