MCPcopy Create free account
hub / github.com/Teneted/Tenet / getDirection

Method getDirection

src/main/java/org/bukkit/Location.java:285–300  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

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

Callers 2

rayTraceBlocksMethod · 0.95
launchProjectileMethod · 0.95

Calls 5

getYawMethod · 0.95
getPitchMethod · 0.95
setYMethod · 0.95
setXMethod · 0.95
setZMethod · 0.95

Tested by

no test coverage detected