Skip to content

Implement randomization to "getRotations" in RotationUtils for Killaura rotations. #27

Description

This is a very basic implementation of Randomization. Add it or not I don't care, I just was bored in class and thought I'd help. (Also I have no idea if this is formatted correctly since I wrote this code on a school Chromebook..)

public static float[] getRotations(float[] last, Vec3d eye, Entity entity) {
        Vec3d to = entity.getEyePos();
        Vec3d diff = to.subtract(eye);
        double dist = Math.sqrt(diff.x * diff.x + diff.z * diff.z);

        float pitch = (float) Math.toDegrees(-Math.atan2(diff.y - 0.5, dist));
        float yaw = (float) Math.toDegrees(Math.atan2(diff.z, diff.x)) - 90;

        yaw = unwrap(last[0], yaw);

        // Basic Randomization (Made by Arxhive55)
        float rand = (float) (Math.random() - Math.random());
        yaw += rand;
        pitch -= rand;

       MathUtils.wrapAngleTo180_float(yaw);
       MathUtils.wrapAngleTo180_float(pitch);

        return new float[]{yaw, pitch};
    }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions