0 votes

I'm adding an opening transition animation and I want the node and its children (consisting of stuff such as kinematicbodies and such) to not do anything until the animation finishes. Only problem is that does not seem to work and the kinematicbodies still do stuff before they're supposed to. This is on version 3.3.2

I want to ask why this could be happening and what I could do to fix this? Thanks

Code snippet below:

extends Node2D

onready var circleTransitionAnim = $CircleTransition/AnimationPlayer

func _ready():
    circleTransitionAnim.play("transition_in")
    set_physics_process(false)

func _on_AnimationPlayer_animation_finished(anim_name): 
    set_physics_process(true)

*EDIT FOR CLARITY:

My node has several child nodes each with _physics_process() functions and THOSE are the ones I want to disable. I have since tried the code snippet below but it also does not work

func _ready():
    for i in get_children():
        set_physics_process(false)

Any other solutions I could try?

*UPDATE:

I'm an idiot and forgot to make it i.set_physics_process(false) insted of just set_physics_process(false). It's working fine now.

Godot version 3.3.2
in Engine by (12 points)
edited by

1 Answer

0 votes

It is unclear from the code snippet whether this is indeed the source of the problem, but you should keep in mind that set_physics_process() will not interfere with other functions such as _process() or _input(), signal triggers, or method calls from external sources. You need to explicitly call set_process(false) to disable _process(), as well as ignore input handling and the likes.

by (1,259 points)

Sorry should have explained better.

My intent is to disable all _physics_process() functions in the children of the node. I have no _process() or _input() functions to speak of.

I have since tried to do the following in the code below but it doesn't work either

func _ready():
    for i in get_children():
        set_physics_process(false)

*UPDATE:

I'm an idiot and forgot to make it i.set_physics_process(false) insted of just set_physics_process(false). It's working fine now. Thanks for answering.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.