Rotate_x relationship with max fps?

Godot Version



I’m a complete beginner in this game making industry, and learning from a tutorial I saw on YouTube. One of the steps say to spin an object you have to use the internal function of “rotate_x()”, and use "rotate_x(rad_to_deg()). However, I found that the speed of the rotation changes with the max FPS (in Project Settings). Is there any way to spin consistently without having to lower the max FPS?

My Code:

extends Area3D

const ROTATION_SPEED = 2 # Number of Degrees the Coin rotates every frame

# Called when the node enters the scene tree for the first time.
func _ready():
	pass # Replace with function body.

# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):

I don’t know what your code is supposed to do, but if you set your ROTATION_SPEED * delta, the FPS will be converted to seconds. Like below:

func _process(delta):
	rotate_y(deg_to_rad(ROTATION_SPEED * delta))
1 Like

Overall, while working with games, unless using the built-in physics engine (add velocity and move_and_slide()) multiply everything but delta. This will cause the game to move consistently through lag.

1 Like

Figured it out! Thank you!
I changed the _process function to

func _process(delta):
	rotate_y(deg_to_rad(ROTATION_SPEED_DEGREES) * delta)

and changed the ROTATION_SPEED_DEGREES to 120 (2 * 60fps) and it works perfectly!