Want a better Minecraft server? Read about SpigotMC here!
Separate names with a comma.
Discussion in 'Spigot Plugin Development' started by fortressworks, Apr 17, 2019 at 2:13 PM.
Title says it all
You don't. A vector is a direction, not a position.
And I think we only have pitch and yaw in Minecraft.
I think maybe armor stands have some kind of roll property on some of the movable limbs, though I'm not entirely sure.
Though, as others have said, a vector is an object which indicates movement. It's not a location. The X, Y and Z value indicate where the momentum is going. The values of the vector have no relation to an actual location. They're relative values. The higher the values, the greater the force of the vector (higher momentum).
This sounds like an XY problem
Pitch and yaw are actually direction
The roll does not really exist for a direction, you don't need it.
You can simply use
Location l = anyLocation;
If you do not want to use Location, you can still follow this cult tutorial:
Finally if you want the head of an armorstand looking at a direction you can use this:
double yaw = Math.atan2(direction.getZ(), direction.getX());
double pitch = Math.atan2(Math.sqrt(direction.getZ() * direction.getZ() + direction.getX() * direction.getX()), direction.getY()) + Math.PI;
projector.setHeadPose(new EulerAngle(-pitch + Math.toRadians(90), yaw + Math.toRadians(90), 0));