Montigordev
Member
Hello,
I have camera following the player and when player moves diagonally everything in games starts to jitter and shake.
--Player code :--
keyLeft = keyboard_check(ord("A"));
keyRight = keyboard_check(ord("D"));
keyUp = keyboard_check(ord("W"));
keyDown= keyboard_check(ord("S"));
hspd = keyRight - keyLeft;
vspd = keyDown - keyUp;
inputDirection = point_direction(0,0,keyRight - keyLeft, keyDown - keyUp);
inputMagnitude = (keyRight - keyLeft != 0) or (keyDown - keyUp != 0);
//Movement
hspd = lengthdir_x(inputMagnitude * spd, inputDirection);
vspd = lengthdir_y(inputMagnitude * spd, inputDirection);
x += hspd;
y += vspd;
---------------------------------------------------------------
--Camera code: --
cx = camera_get_view_x(view_camera[0]);
cy = camera_get_view_y(view_camera[0]);
cx = lerp(following.x,mouse_x,0.1) - (view_w/2);
cy = lerp(following.y,mouse_y,0.1) - (view_h/2);
camera_set_view_pos(view_camera[0], cx, cy);
Is there any solutions for that?
Thanks in advance.
I have camera following the player and when player moves diagonally everything in games starts to jitter and shake.
--Player code :--
keyLeft = keyboard_check(ord("A"));
keyRight = keyboard_check(ord("D"));
keyUp = keyboard_check(ord("W"));
keyDown= keyboard_check(ord("S"));
hspd = keyRight - keyLeft;
vspd = keyDown - keyUp;
inputDirection = point_direction(0,0,keyRight - keyLeft, keyDown - keyUp);
inputMagnitude = (keyRight - keyLeft != 0) or (keyDown - keyUp != 0);
//Movement
hspd = lengthdir_x(inputMagnitude * spd, inputDirection);
vspd = lengthdir_y(inputMagnitude * spd, inputDirection);
x += hspd;
y += vspd;
---------------------------------------------------------------
--Camera code: --
cx = camera_get_view_x(view_camera[0]);
cy = camera_get_view_y(view_camera[0]);
cx = lerp(following.x,mouse_x,0.1) - (view_w/2);
cy = lerp(following.y,mouse_y,0.1) - (view_h/2);
camera_set_view_pos(view_camera[0], cx, cy);
Is there any solutions for that?
Thanks in advance.