better mouse movement

This commit is contained in:
GiantLuigi4 2023-11-24 18:04:09 -05:00
parent 84d475d61c
commit f843376f7a

View File

@ -88,6 +88,20 @@ public class KeyboardCamera {
nextX = c.x;
nextY = c.y;
float scl = Math.max(scr.size.x, scr.size.y) / 1.0f;
double mx = Minecraft.getInstance().mouseHandler.xpos();
mx /= Minecraft.getInstance().getWindow().getWidth();
double my = Minecraft.getInstance().mouseHandler.ypos();
my /= Minecraft.getInstance().getWindow().getHeight();
Vec2 v2 = new Vec2((float) mx, (float) my).add(-0.5f);
// v2 = v2.normalized().scale(Mth.sqrt(v2.length()));
nextX += v2.x * scl;
nextY -= v2.y * scl;
// if (side.right.x > 0)
// nextX += 1.f;
// if (side.right.z > 0)