Welcome on MasterOf13FPS! MasterOf13FPS

Register today or sign up if you are already a member and never miss any cool content again :)

ideas on how i can code smooth rotations for killaura?

Tengoku

Member
Joined
Nov 1, 2021
Messages
41
Reaction score
2
Points
8
i already have rotations for killaura, but if the target is moving i get flagged for fight_direction (NCP), this is because the rotations are a bit "delayed" and the head dosent really move smoothly and instantly so that it dosent flag for fight direction, so does anyone know how i can make my current rotations smooth? thanks!

ROTATION UTIL:
public class RotationUtil {
public static float[] getRotations(EntityLivingBase ent) {
double x = ent.posX;
double z = ent.posZ;
double y = ent.posY + ent.getEyeHeight() / 2.0F;
return getRotationFromPosition(x, z, y);
}

public static float[] getAverageRotations(List<EntityLivingBase> targetList) {
double posX = 0.0D;
double posY = 0.0D;
double posZ = 0.0D;
for (Entity ent : targetList) {
posX += ent.posX;
posY += ent.boundingBox.maxY - 2.0D;
posZ += ent.posZ;
}
posX /= targetList.size();
posY /= targetList.size();
posZ /= targetList.size();

return new float[]{getRotationFromPosition(posX, posZ, posY)[0], getRotationFromPosition(posX, posZ, posY)[1]};
}

public static float[] getBowAngles(final Entity entity) {
final double xDelta = entity.posX - entity.lastTickPosX;
final double zDelta = entity.posZ - entity.lastTickPosZ;
double d = Minecraft.getMinecraft().thePlayer.getDistanceToEntity(entity);
d -= d % 0.8;
double xMulti = 1.0;
double zMulti = 1.0;
final boolean sprint = entity.isSprinting();
xMulti = d / 0.8 * xDelta * (sprint ? 1.25 : 1.0);
zMulti = d / 0.8 * zDelta * (sprint ? 1.25 : 1.0);
final double x = entity.posX + xMulti - Minecraft.getMinecraft().thePlayer.posX;
final double z = entity.posZ + zMulti - Minecraft.getMinecraft().thePlayer.posZ;
final double y = Minecraft.getMinecraft().thePlayer.posY + Minecraft.getMinecraft().thePlayer.getEyeHeight() - (entity.posY + entity.getEyeHeight());
final double dist = Minecraft.getMinecraft().thePlayer.getDistanceToEntity(entity);
final float yaw = (float) Math.toDegrees(Math.atan2(z, x)) - 90.0f;
final float pitch = (float) Math.toDegrees(Math.atan2(y, dist));
return new float[]{yaw, pitch};
}

public static float[] getRotationFromPosition(double x, double z, double y) {
double xDiff = x - Minecraft.getMinecraft().thePlayer.posX;
double zDiff = z - Minecraft.getMinecraft().thePlayer.posZ;
double yDiff = y - Minecraft.getMinecraft().thePlayer.posY - 1.2;

double dist = MathHelper.sqrt_double(xDiff * xDiff + zDiff * zDiff);
float yaw = (float) (Math.atan2(zDiff, xDiff) * 180.0D / 3.141592653589793D) - 90.0F;
float pitch = (float) -(Math.atan2(yDiff, dist) * 180.0D / 3.141592653589793D);
return new float[]{yaw, pitch};
}

public static float getTrajAngleSolutionLow(float d3, float d1, float velocity) {
float g = 0.006F;
float sqrt = velocity * velocity * velocity * velocity - g * (g * (d3 * d3) + 2.0F * d1 * (velocity * velocity));
return (float) Math.toDegrees(Math.atan((velocity * velocity - Math.sqrt(sqrt)) / (g * d3)));
}

public static float getYawChange(double posX, double posZ) {
double deltaX = posX - Minecraft.getMinecraft().thePlayer.posX;
double deltaZ = posZ - Minecraft.getMinecraft().thePlayer.posZ;
double yawToEntity;
if ((deltaZ < 0.0D) && (deltaX < 0.0D)) {
yawToEntity = 90.0D + Math.toDegrees(Math.atan(deltaZ / deltaX));
} else if ((deltaZ < 0.0D) && (deltaX > 0.0D)) {
yawToEntity = -90.0D + Math.toDegrees(Math.atan(deltaZ / deltaX));
} else {
yawToEntity = Math.toDegrees(-Math.atan(deltaX / deltaZ));
}
return MathHelper.wrapAngleTo180_float(-(Minecraft.getMinecraft().thePlayer.rotationYaw - (float) yawToEntity));
}

public static float getPitchChange(Entity entity, double posY) {
double deltaX = entity.posX - Minecraft.getMinecraft().thePlayer.posX;
double deltaZ = entity.posZ - Minecraft.getMinecraft().thePlayer.posZ;
double deltaY = posY - 2.2D + entity.getEyeHeight() - Minecraft.getMinecraft().thePlayer.posY;
double distanceXZ = MathHelper.sqrt_double(deltaX * deltaX + deltaZ * deltaZ);
double pitchToEntity = -Math.toDegrees(Math.atan(deltaY / distanceXZ));
return -MathHelper.wrapAngleTo180_float(Minecraft.getMinecraft().thePlayer.rotationPitch - (float) pitchToEntity) - 2.5F;
}


public static float getNewAngle(float angle) {
angle %= 360.0F;
if (angle >= 180.0F) {
angle -= 360.0F;
}
if (angle < -180.0F) {
angle += 360.0F;
}
return angle;
}

public static float getDistanceBetweenAngles(float angle1, float angle2) {
float angle = Math.abs(angle1 - angle2) % 360.0F;
if (angle > 180.0F) {
angle = 360.0F - angle;
}
return angle;
}
}
 
Stop pasing out of leaked clients, "3.141592653589793D"
 
update: i dont need them anymore, i managed to code them.
 
bro its just digits of pi...
retarded?
You use Math.PI
If you compile your client and somebody else uses a decompiler the constant will no longer be present, because it was compiled.
Means everyone not using Math.PI is either retarded and stupid or more likely pasting from some source which was decompiled.
If you dont know shit about what you are talking then stfu.
 
retarded?
You use Math.PI
If you compile your client and somebody else uses a decompiler the constant will no longer be present, because it was compiled.
Means everyone not using Math.PI is either retarded and stupid or more likely pasting from some source which was decompiled.
If you dont know shit about what you are talking then stfu.
i look up the first 100 digits the pi and use it, get on my level
 
i already have rotations for killaura, but if the target is moving i get flagged for fight_direction (NCP), this is because the rotations are a bit "delayed" and the head dosent really move smoothly and instantly so that it dosent flag for fight direction, so does anyone know how i can make my current rotations smooth? thanks!

ROTATION UTIL:
public class RotationUtil {
public static float[] getRotations(EntityLivingBase ent) {
double x = ent.posX;
double z = ent.posZ;
double y = ent.posY + ent.getEyeHeight() / 2.0F;
return getRotationFromPosition(x, z, y);
}

public static float[] getAverageRotations(List<EntityLivingBase> targetList) {
double posX = 0.0D;
double posY = 0.0D;
double posZ = 0.0D;
for (Entity ent : targetList) {
posX += ent.posX;
posY += ent.boundingBox.maxY - 2.0D;
posZ += ent.posZ;
}
posX /= targetList.size();
posY /= targetList.size();
posZ /= targetList.size();

return new float[]{getRotationFromPosition(posX, posZ, posY)[0], getRotationFromPosition(posX, posZ, posY)[1]};
}

public static float[] getBowAngles(final Entity entity) {
final double xDelta = entity.posX - entity.lastTickPosX;
final double zDelta = entity.posZ - entity.lastTickPosZ;
double d = Minecraft.getMinecraft().thePlayer.getDistanceToEntity(entity);
d -= d % 0.8;
double xMulti = 1.0;
double zMulti = 1.0;
final boolean sprint = entity.isSprinting();
xMulti = d / 0.8 * xDelta * (sprint ? 1.25 : 1.0);
zMulti = d / 0.8 * zDelta * (sprint ? 1.25 : 1.0);
final double x = entity.posX + xMulti - Minecraft.getMinecraft().thePlayer.posX;
final double z = entity.posZ + zMulti - Minecraft.getMinecraft().thePlayer.posZ;
final double y = Minecraft.getMinecraft().thePlayer.posY + Minecraft.getMinecraft().thePlayer.getEyeHeight() - (entity.posY + entity.getEyeHeight());
final double dist = Minecraft.getMinecraft().thePlayer.getDistanceToEntity(entity);
final float yaw = (float) Math.toDegrees(Math.atan2(z, x)) - 90.0f;
final float pitch = (float) Math.toDegrees(Math.atan2(y, dist));
return new float[]{yaw, pitch};
}

public static float[] getRotationFromPosition(double x, double z, double y) {
double xDiff = x - Minecraft.getMinecraft().thePlayer.posX;
double zDiff = z - Minecraft.getMinecraft().thePlayer.posZ;
double yDiff = y - Minecraft.getMinecraft().thePlayer.posY - 1.2;

double dist = MathHelper.sqrt_double(xDiff * xDiff + zDiff * zDiff);
float yaw = (float) (Math.atan2(zDiff, xDiff) * 180.0D / 3.141592653589793D) - 90.0F;
float pitch = (float) -(Math.atan2(yDiff, dist) * 180.0D / 3.141592653589793D);
return new float[]{yaw, pitch};
}

public static float getTrajAngleSolutionLow(float d3, float d1, float velocity) {
float g = 0.006F;
float sqrt = velocity * velocity * velocity * velocity - g * (g * (d3 * d3) + 2.0F * d1 * (velocity * velocity));
return (float) Math.toDegrees(Math.atan((velocity * velocity - Math.sqrt(sqrt)) / (g * d3)));
}

public static float getYawChange(double posX, double posZ) {
double deltaX = posX - Minecraft.getMinecraft().thePlayer.posX;
double deltaZ = posZ - Minecraft.getMinecraft().thePlayer.posZ;
double yawToEntity;
if ((deltaZ < 0.0D) && (deltaX < 0.0D)) {
yawToEntity = 90.0D + Math.toDegrees(Math.atan(deltaZ / deltaX));
} else if ((deltaZ < 0.0D) && (deltaX > 0.0D)) {
yawToEntity = -90.0D + Math.toDegrees(Math.atan(deltaZ / deltaX));
} else {
yawToEntity = Math.toDegrees(-Math.atan(deltaX / deltaZ));
}
return MathHelper.wrapAngleTo180_float(-(Minecraft.getMinecraft().thePlayer.rotationYaw - (float) yawToEntity));
}

public static float getPitchChange(Entity entity, double posY) {
double deltaX = entity.posX - Minecraft.getMinecraft().thePlayer.posX;
double deltaZ = entity.posZ - Minecraft.getMinecraft().thePlayer.posZ;
double deltaY = posY - 2.2D + entity.getEyeHeight() - Minecraft.getMinecraft().thePlayer.posY;
double distanceXZ = MathHelper.sqrt_double(deltaX * deltaX + deltaZ * deltaZ);
double pitchToEntity = -Math.toDegrees(Math.atan(deltaY / distanceXZ));
return -MathHelper.wrapAngleTo180_float(Minecraft.getMinecraft().thePlayer.rotationPitch - (float) pitchToEntity) - 2.5F;
}


public static float getNewAngle(float angle) {
angle %= 360.0F;
if (angle >= 180.0F) {
angle -= 360.0F;
}
if (angle < -180.0F) {
angle += 360.0F;
}
return angle;
}

public static float getDistanceBetweenAngles(float angle1, float angle2) {
float angle = Math.abs(angle1 - angle2) % 360.0F;
if (angle > 180.0F) {
angle = 360.0F - angle;
}
return angle;
}
}
I'm not sure but if you want to do smooth aiming you can use tojatta's api (im not sure if that's good idea)
or you can probably use this: https://masterof13fps.com/forum/index.php?threads/animations-with-easings.7816/
you can create animations for yaw and pitch and when target is found just animate it, instead pitch or yaw use animation.getValue()
 
I'm not sure but if you want to do smooth aiming you can use tojatta's api (im not sure if that's good idea)
or you can probably use this: https://masterof13fps.com/forum/index.php?threads/animations-with-easings.7816/
you can create animations for yaw and pitch and when target is found just animate it, instead pitch or yaw use animation.getValue()
He already said that he have figured it out, PS how about stop using trash libarys and using minecraft code to smooth your rotation?
 
He already said that he have figured it out, PS how about stop using trash libarys and using minecraft code to smooth your rotation?
wow!
wdym about trash librarys lmao im sure you arent checked this page, i made it for me, but i made repo for helping people making easily animations. also for u i repeat and change my question.
where you found "trash lib" if it's just made for me and new guys in java?
how about just shutup, cuz u said trash. i just posted my idea how to make smooth rots easily and fast. if you find in this:
"USE ONLY MY LIB LGMFAOF ITS BEST LIB HEEEY YOU CAN USE IT WHY U DOESNT USE IT U R STUPID OR WHATTATTA??"
i said it for helping also other guys which cannot understand "use minecraft code to smooth rots".
u really stupid and toxic cuz u just started insult me and my little lib which mainly made for me.
 
wow!
wdym about trash librarys lmao im sure you arent checked this page, i made it for me, but i made repo for helping people making easily animations. also for u i repeat and change my question.
where you found "trash lib" if it's just made for me and new guys in java?
how about just shutup, cuz u said trash. i just posted my idea how to make smooth rots easily and fast. if you find in this:
"USE ONLY MY LIB LGMFAOF ITS BEST LIB HEEEY YOU CAN USE IT WHY U DOESNT USE IT U R STUPID OR WHATTATTA??"
i said it for helping also other guys which cannot understand "use minecraft code to smooth rots".
u really stupid and toxic cuz u just started insult me and my little lib which mainly made for me.
One of the best methods to smooth rotations are in the minecraft source code so imo no one should use some trash self-written shit... I didnt even mean to offense/insult you but you clearly feel attacked which i can't relate bruh

And idk how you can feel litterally attacked when i say that using libarys is trash when the minecraft code already have that feature

TLDR; I didnt mean to offense you by saying "trash" to a lib..


EntityLookHelper:.java
Java:
    private float updateRotation(float p_75652_1_, float p_75652_2_, float p_75652_3_)
    {
        float f = MathHelper.wrapAngleTo180_float(p_75652_2_ - p_75652_1_);

        if (f > p_75652_3_)
        {
            f = p_75652_3_;
        }

        if (f < -p_75652_3_)
        {
            f = -p_75652_3_;
        }

        return p_75652_1_ + f;
    }
 
One of the best methods to smooth rotations are in the minecraft source code so imo no one should use some trash self-written shit... I didnt even mean to offense/insult you but you clearly feel attacked which i can't relate bruh

And idk how you can feel litterally attacked when i say that using libarys is trash when the minecraft code already have that feature

TLDR; I didnt mean to offense you by saying "trash" to a lib..


EntityLookHelper:.java
Java:
    private float updateRotation(float p_75652_1_, float p_75652_2_, float p_75652_3_)
    {
        float f = MathHelper.wrapAngleTo180_float(p_75652_2_ - p_75652_1_);

        if (f > p_75652_3_)
        {
            f = p_75652_3_;
        }

        if (f < -p_75652_3_)
        {
            f = -p_75652_3_;
        }

        return p_75652_1_ + f;
    }
im isnt offensed by words "trash" to a lib. i mean i did that lib only for people which wants know how to do animations and made not default idea how to realize that.
k so im not saying if these lib is best method. its just not difficult method how to smooth rots, and cuz idk how works any anticheats, but for example u can use easings for rots which wont flagged. (its only my thoughts, but ye your method is better)
 
i already have rotations for killaura, but if the target is moving i get flagged for fight_direction (NCP), this is because the rotations are a bit "delayed" and the head dosent really move smoothly and instantly so that it dosent flag for fight direction, so does anyone know how i can make my current rotations smooth? thanks!

ROTATION UTIL:
public class RotationUtil {
public static float[] getRotations(EntityLivingBase ent) {
double x = ent.posX;
double z = ent.posZ;
double y = ent.posY + ent.getEyeHeight() / 2.0F;
return getRotationFromPosition(x, z, y);
}

public static float[] getAverageRotations(List<EntityLivingBase> targetList) {
double posX = 0.0D;
double posY = 0.0D;
double posZ = 0.0D;
for (Entity ent : targetList) {
posX += ent.posX;
posY += ent.boundingBox.maxY - 2.0D;
posZ += ent.posZ;
}
posX /= targetList.size();
posY /= targetList.size();
posZ /= targetList.size();

return new float[]{getRotationFromPosition(posX, posZ, posY)[0], getRotationFromPosition(posX, posZ, posY)[1]};
}

public static float[] getBowAngles(final Entity entity) {
final double xDelta = entity.posX - entity.lastTickPosX;
final double zDelta = entity.posZ - entity.lastTickPosZ;
double d = Minecraft.getMinecraft().thePlayer.getDistanceToEntity(entity);
d -= d % 0.8;
double xMulti = 1.0;
double zMulti = 1.0;
final boolean sprint = entity.isSprinting();
xMulti = d / 0.8 * xDelta * (sprint ? 1.25 : 1.0);
zMulti = d / 0.8 * zDelta * (sprint ? 1.25 : 1.0);
final double x = entity.posX + xMulti - Minecraft.getMinecraft().thePlayer.posX;
final double z = entity.posZ + zMulti - Minecraft.getMinecraft().thePlayer.posZ;
final double y = Minecraft.getMinecraft().thePlayer.posY + Minecraft.getMinecraft().thePlayer.getEyeHeight() - (entity.posY + entity.getEyeHeight());
final double dist = Minecraft.getMinecraft().thePlayer.getDistanceToEntity(entity);
final float yaw = (float) Math.toDegrees(Math.atan2(z, x)) - 90.0f;
final float pitch = (float) Math.toDegrees(Math.atan2(y, dist));
return new float[]{yaw, pitch};
}

public static float[] getRotationFromPosition(double x, double z, double y) {
double xDiff = x - Minecraft.getMinecraft().thePlayer.posX;
double zDiff = z - Minecraft.getMinecraft().thePlayer.posZ;
double yDiff = y - Minecraft.getMinecraft().thePlayer.posY - 1.2;

double dist = MathHelper.sqrt_double(xDiff * xDiff + zDiff * zDiff);
float yaw = (float) (Math.atan2(zDiff, xDiff) * 180.0D / 3.141592653589793D) - 90.0F;
float pitch = (float) -(Math.atan2(yDiff, dist) * 180.0D / 3.141592653589793D);
return new float[]{yaw, pitch};
}

public static float getTrajAngleSolutionLow(float d3, float d1, float velocity) {
float g = 0.006F;
float sqrt = velocity * velocity * velocity * velocity - g * (g * (d3 * d3) + 2.0F * d1 * (velocity * velocity));
return (float) Math.toDegrees(Math.atan((velocity * velocity - Math.sqrt(sqrt)) / (g * d3)));
}

public static float getYawChange(double posX, double posZ) {
double deltaX = posX - Minecraft.getMinecraft().thePlayer.posX;
double deltaZ = posZ - Minecraft.getMinecraft().thePlayer.posZ;
double yawToEntity;
if ((deltaZ < 0.0D) && (deltaX < 0.0D)) {
yawToEntity = 90.0D + Math.toDegrees(Math.atan(deltaZ / deltaX));
} else if ((deltaZ < 0.0D) && (deltaX > 0.0D)) {
yawToEntity = -90.0D + Math.toDegrees(Math.atan(deltaZ / deltaX));
} else {
yawToEntity = Math.toDegrees(-Math.atan(deltaX / deltaZ));
}
return MathHelper.wrapAngleTo180_float(-(Minecraft.getMinecraft().thePlayer.rotationYaw - (float) yawToEntity));
}

public static float getPitchChange(Entity entity, double posY) {
double deltaX = entity.posX - Minecraft.getMinecraft().thePlayer.posX;
double deltaZ = entity.posZ - Minecraft.getMinecraft().thePlayer.posZ;
double deltaY = posY - 2.2D + entity.getEyeHeight() - Minecraft.getMinecraft().thePlayer.posY;
double distanceXZ = MathHelper.sqrt_double(deltaX * deltaX + deltaZ * deltaZ);
double pitchToEntity = -Math.toDegrees(Math.atan(deltaY / distanceXZ));
return -MathHelper.wrapAngleTo180_float(Minecraft.getMinecraft().thePlayer.rotationPitch - (float) pitchToEntity) - 2.5F;
}


public static float getNewAngle(float angle) {
angle %= 360.0F;
if (angle >= 180.0F) {
angle -= 360.0F;
}
if (angle < -180.0F) {
angle += 360.0F;
}
return angle;
}

public static float getDistanceBetweenAngles(float angle1, float angle2) {
float angle = Math.abs(angle1 - angle2) % 360.0F;
if (angle > 180.0F) {
angle = 360.0F - angle;
}
return angle;
}
}
You should try watching Exeos's KillAura tutorial, their rotations bypass.
 
shape1
shape2
shape3
shape4
shape5
shape6
Back
Top