Hello,
I tried to set a specific collision mask value to false when a certain condition is met
func _physics_process(delta):
handle_gravity(delta)
move_and_slide()
update_animation()
death()
evolution_check()
if evolve_allowed == true and start_absorbed_anim == false:
set_collision_mask_value(4, false)
I noticed that setting the collision mask value in the _ready() function works, but when I try to do it in _physics_process(delta) it doesn’t seem to work.
Does anyone have suggestions on how to properly disable a collision masks during the physics process?
Thanks for the response!
I found that using call_deferred() doesn’t solve the problem, but I learned that it’s a safer way for changing physics layers mid frame.
Apparently, changing the layer while disabling the previous layer and mask fixes the problem
if evolve_allowed == true and start_absorbed_anim == false:
set_collision_layer_value.call_deferred(4, false)
set_collision_mask_value.call_deferred(4, false)
set_collision_layer_value.call_deferred(5, true)