diff --git a/data/scripts/classes/player.lua b/data/scripts/classes/player.lua index c9a0137..e93448e 100644 --- a/data/scripts/classes/player.lua +++ b/data/scripts/classes/player.lua @@ -10,6 +10,8 @@ local Player = { yaw = 0, yaw_speed = 0.05, + + accel = 0.3, ThrowPressed = Signal.new(), } @@ -20,7 +22,7 @@ function Player:tick(ctx) input_action{name = "forward", control = "W"} input_action{name = "back", control = "S"} - input_action{name = "throw", control = "SPACE"} + input_action{name = "throw", control = "LCLICK"} local camera_forward = Vector3(draw_camera_from_principal_axes(self).direction) camera_forward.y = 0 @@ -31,7 +33,9 @@ function Player:tick(ctx) local strafe_input = util.b2n(input_action_pressed{name = "right"}) - util.b2n(input_action_pressed{name = "left"}) local direction = ((camera_forward * forward_input) + (camera_right * strafe_input)):normalized() - self.velocity = direction * self.speed + local target_vel = direction * self.speed + self.velocity = self.velocity:lerp(target_vel, self.accel) + -- self.velocity = target_vel if input_action_just_pressed{name = "throw"} then self.ThrowPressed:emit(self.position:copy(), camera_forward:copy())