Jump to content

Entity#setAngles 1.8.9


Ardno

Recommended Posts

Hello,

I'm trying to create smoothly camera rotation effect, but method .setAngles(float f1, float f2) didn't work. Where is a problem?

 

Code:

public static void glide(EntityPlayer player, float yaw2, float pitch2, int time, int smoothness) {
        float yaw1 = player.rotationYaw;
        float pitch1 = player.rotationPitch;

        double dyaw = (yaw2 - yaw1) / ((double) smoothness);
        double dpitch = (pitch2 - pitch1) / ((double) smoothness);
        double dtime = time / ((double) smoothness);

        try {
            for (int step = 1; step <= smoothness; step++) {
                Thread.sleep((int) dtime);
                player.setAngles((float) (yaw1 + dyaw * step), (float) (pitch1 + dpitch * step));
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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