Jump to content

[SOLVED] [1.15.2] Camera yaw issues


Novârch

Recommended Posts

I've been trying to create a remote controlled entity, it's been going pretty well so far, though I have a single issue. To move the camera I've opted for how AbstractHorseEntity does it, copying the player's yaw and pitch values. This works fine until the yaw value reaches 360, upon which it abruptly snaps to about -90 and then returns to 0. Can anyone tell me what's causing this? The code for the entity can be found here.

It's sad how much time mods spend saying "x is no longer supported on this forum. Please update to a modern version of Minecraft to receive support".

Link to comment
Share on other sites

4 hours ago, Novârch said:

Can anyone tell me what's causing this?

Try moving the line

prevRotationYaw = rotationYaw;

below the line

setRotation(rotationYaw, rotationPitch);

 

You could also try overriding getYaw() to simply return rotationYaw, since getYaw() is what is used to determine the viewport yaw.

  • Like 1
Link to comment
Share on other sites

15 minutes ago, vemerion said:

You could also try overriding getYaw() to simply return rotationYaw, since getYaw() is what is used to determine the viewport yaw.

This works, though it makes the rotation a heck of a lot less smooth. Nonetheless, thank you.

It's sad how much time mods spend saying "x is no longer supported on this forum. Please update to a modern version of Minecraft to receive support".

Link to comment
Share on other sites

  • Novârch changed the title to [SOLVED] [1.15.2] Camera yaw issues
14 minutes ago, Novârch said:

This works, though it makes the rotation a heck of a lot less smooth. Nonetheless, thank you.

Yes, the unfortunate side-effect of this solution is that it effectively reduces the update rate of the yaw rotation to 20 fps. A more sophisticated method might call super.getYaw() in most cases, and only resort to returning rotationYaw in the case when the rotation goes from 360 -> 0, or similar.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.