@CzechHek said in How to use LiquidBounce's rotations utils in a script?:
I don't know what isn't clear to you.
Here is an example:
if (e.getEventState() == "PRE") {
entity = getNearestTarget(EntityZombie);
diffX = entity.posX - mc.thePlayer.posX;
diffY = entity.posY - mc.thePlayer.posY;
diffZ = entity.posZ - mc.thePlayer.posZ;
rotation = new Rotation((Math.atan2(diffZ, diffX) * 180 / Math.PI) - 90, -(Math.atan2(diffY, Math.sqrt(diffX * diffX + diffZ * diffZ)) * 180 / Math.PI));
limitedRotation = RotationUtils.limitAngleChange(RotationUtils.serverRotation, rotation, 20);
RotationUtils.setTargetRotation(limitedRotation);
//limitedRotation.toPlayer(mc.thePlayer);
}
If I understood properly, it should rotate at the closest zombie with a rotation speed of 20 max