I’m creating a hoverboard system and I’m trying to limit the velocity of the hoverboard. When I try and do this per axis it starts to turn because it’s reaching the max velocity on one axis and not the other. Here is the code:
velocity = Vector3.new(
math.clamp(HoverboardController.velocity.X + velocity.X * 4, -30, 30),
math.clamp(HoverboardController.velocity.Y + velocity.Y * 4, -30, 30),
math.clamp(HoverboardController.velocity.Z + velocity.Z * 4, -30, 30)
)
HoverboardController.velocity is the total velocity and “velocity” is just the caculated velocity for that frame.