Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Nichefect | |
Old Version | Published before Godot 3 was released. |
The description of the two is too vague for someone inexperienced like me, so could somebody explain to me the difference between process and fixed_process, and what types of procedures are appropriate for each one?
The reason I’m asking this is because of a problem I was having with the frame rate of a project. I was using the following procedure for screen scrolling in the script for the container(root) node of a project to handle scrolling. I was running this procedure in _fixed_process:
var t = get_viewport().get_canvas_transform()
if(player.right):
t[2] += Vector2(-player.MOVE_SPEED*delta, 0)
if(player.left):
t[2] += Vector2(player.MOVE_SPEED*delta, 0)
get_viewport().set_canvas_transform(t)
When doing this, the frame rate would stutter about every ten seconds. I moved the procedure to _process and the stutter went away and I’m wondering why this helped.
Also, the Player node still stutters every ten seconds, but when I moved its procedures from _fixed_process to _process the player acts all crazy and bounces around and doesn’t work properly at all.
P.S. noticed the underscores are sometimes not included in the text where I’m referring to the different process functions, but I’m gonna assume everyone knows what I’m talking about.