`i have a gun model i made it when i shot it rotates the gun barrels mesh on the x axis “spins on the x axis” but i want it to gradually rotates to a full stop smoothly after releasing the shot button i have been trying but my coding skills are not there yet i couldn’t figure out how to do it, any help is appreciated
There are many ways to spin in Godot, can you share your code/AnimationPlayer/scene tree? How did you get it to spin in the first place? Why won’t it stop?
so it stops when i release my shot button but i want to do it gradually, i just rotate the mesh on the x axis like barrels.rotate.x(value) , it is gives me what i want which is to reach the max speed as soon i shot but after releasing the shot button i want it gradually stops rotating
if im getting it right it’s losing 1% speed each frame because it’s running in the physics func “delta” so will the stop time change based on the framerates? is there any thing i need to know to prevent issues i might face later?
This is true. it is frame-dependent a user with un-capped framerate of say 1000 would slow down immediately. If this is only a visual effect then that will be the only problem.
You could use move_toward with delta to make it significantly less frame-dependent, this would slow to zero from a full rotation/s in one second. Accelration units are always hard to write, to zero by 1 rotation per second per second.
func _process(delta: float) -> void:
value = move_toward(value, 0, TAU * delta)