Axis button mapping - character turn speed tied to frame rate?

I’m creating a game where the player’s character is positioned at the center of the screen, and you turn the character using the left and right arrow keys. I have that part set up and it’s working, but I’m running into a problem where the speed that the character turns is affected by the game’s frame rate. The higher the frame rate, the faster the character turns. When I run the game in the editor viewport, it runs at about 120 fps. If I run it as a standalone game with vsync enabled, it runs at 60 fps and the player turns at about half the speed. With vsync disabled, the standalone game runs at about 400 fps and the player turns insanely fast.

Is there a way to get around this so the character always turns at the same speed regardless of the frame rate?

This screenshot shows how I have it set up. The Player_MoveSpeed variable is just multiplied by the axis value to adjust the speed that the character turns.

Multiply your final speed by the result of a Get World Delta Seconds node. When you change a value over time you do it at some speed, say 100 deg/s, 10cm/s. What you’re doing right now is rotating at Player_MoveSpeed degrees per frame. You’re adding the same amount of rotation per frame, but how often you add that rotation changes with the framerate, so your player changes rotation speed depending on the framerate. What you want to do is make it rotate at Player_MoveSpeed degrees per second, which is why you multiply by Get World Delta Seconds. The end result is how far you rotate in (1/framerate) of a second, which is how often you’re adding that rotation, giving you a consistent rotation of Player_MoveSpeed deg/s.

Aha! That makes sense, and it worked. Thanks! :slight_smile: