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

Method rotateAroundY

paper-api/src/main/java/org/bukkit/util/Vector.java:465–473  ·  view source on GitHub ↗

Rotates the vector around the y axis. This piece of math is based on the standard rotation matrix for vectors in three dimensional space. This matrix can be found here: Rotation Matrix . @param angle the angle to rotate

(double angle)

Source from the content-addressed store, hash-verified

463 * @return the same vector
464 */
465 @NotNull
466 public Vector rotateAroundY(double angle) {
467 double angleCos = Math.cos(angle);
468 double angleSin = Math.sin(angle);
469
470 double x = angleCos * getX() + angleSin * getZ();
471 double z = -angleSin * getX() + angleCos * getZ();
472 return setX(x).setZ(z);
473 }
474
475 /**
476 * Rotates the vector around the z axis

Callers 1

testRotationAroundYMethod · 0.80

Calls 4

getXMethod · 0.95
getZMethod · 0.95
setXMethod · 0.95
setZMethod · 0.45

Tested by 1

testRotationAroundYMethod · 0.64