Godot Version
4.4
Question
hello,
I have an enemy with 5 states… idlePatrol, idleAlert, shoot, pain, dead
when i change states i use ““set_process_mode”” to enable / disable the node states, and change the collisionBox and hurtBox shape using these functions
func _changeNode_FromTo( from, to ):
from.set_process_mode(Node.PROCESS_MODE_DISABLED)
to.set_process_mode(Node.PROCESS_MODE_INHERIT);
velocity.x = 0;
skel.anim_delayReset = true;
$Timer.stop();
skel.animPlayTimes = 0;
@onready var colBox = $collisionBox;
@onready var hurtShape = $direction/hurtBox/hurtShape
func _changeCollision( posY, sizeX, sizeY ): # on hold
colBox.position.y = posY;
colBox.shape.size.y = sizeY;
hurtShape.position.y = posY;
hurtShape.shape.size.x = sizeX;
hurtShape.shape.size.y = sizeY;
ive printed the ““get_process_mode()”” in all nodes and… actives ones are 0 disabled ones are 4, so everything is correct
but i cant change the collision and hurtbox shape ?!?
if i use this on idlePatrol: _guard01._changeCollision(-90, 30, 180); # standing
everything goes to hell ?!?
If i change the collision on the state node shoot, for shooting down_guard01._changeCollision(-64, 30, 128); # crouching
, the collisionBox makes the enemy standing in the air ?!?
This only happens if i use “”_changeCollision"" in ““idlePatrol””… all the other states i can change the collision without any problem…
Does the ““func _process(_delta: float)”” is still running if PROCESS_MODE_DISABLED ?
Is this happening because ““idlePatrol”” process is set to inherit by default ?
Ive searched for hours and dont have anything in the code that messes with the nodes ““collisionBox”” and ““hurtBox shape””
should i make MRP… wth can we never change collision boxes in godot ?! something always goes wrong