MCPcopy Index your code
hub / github.com/PaperMC/Paper / getDirection

Method getDirection

paper-api/src/main/java/org/bukkit/Location.java:293–308  ·  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

291 * #getPitch() pitch} and {@link #getYaw() yaw}
292 */
293 @NotNull
294 public Vector getDirection() {
295 Vector vector = new Vector();
296
297 double rotX = this.getYaw();
298 double rotY = this.getPitch();
299
300 vector.setY(-Math.sin(Math.toRadians(rotY)));
301
302 double xz = Math.cos(Math.toRadians(rotY));
303
304 vector.setX(-xz * Math.sin(Math.toRadians(rotX)));
305 vector.setZ(xz * Math.cos(Math.toRadians(rotX)));
306
307 return vector;
308 }
309
310 /**
311 * Sets the {@link #getYaw() yaw} and {@link #getPitch() pitch} to point

Callers 3

getRandomMethod · 0.95
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 1

getRandomMethod · 0.76