Get Location and Heading

Hello,

I am dealing with player/entity location handling at the moment, and I am not sure which direction I am supposed to go in. I want to be able to recreate a specific location + direction a player is facing. Looking into the methods provided, it seems that i need to use both getLocation() and getHeadRotation(). However, head rotation provides a Vector3d, which provides only an x, y, and a z. I’m not sure if this is what i am supposed to get, I thought the direction someone was looking was supposed to be a pitch and a yaw, or rather, two numbers, not three.

Is this correct, or am i looking in the wrong place?

Thanks :slight_smile:

You do want to do getLocation() and getHeadRotation(). Rotation is simply stored as a Vector3d, although I’m not sure how it’s translated to pitch and yaw, it’s either that sponge uses all three values and translates internally, or only two values in Vector3d

Hmm. Turns out x is pitch, y is yaw, and z is roll, however since minecraft doesnt use roll, its always zero.

Thanks for the help :slight_smile:

1 Like