Some Character2D Nodes Lose Pathing When top_level = true

Godot Version

v4.2.2.stable.official [15073afe3]

Question

3 Actors are spawned for each Unit, they then path to the Actors of the other Unit. Due to the Unit’s transformations being applied to the Actors I set actor.top_level = true. After making this change, only 1 set of Actors are pathing, the others now dont move.

Pre-Change:
Godot_v4.2.2_Kl4oXNVcfc

Post-Change:
Godot_v4.2.2_5D5N0D31xM

The spawn code for the Actor, and the only thing to change:

var actor: Actor = actor_scene.instantiate()
add_child(actor)
actor.top_level = true
actor.global_position = spawn_pos

Any idea what’s happening?

Why are you setting it as top_level?

Thanks for coming back to me. I’m trying to prevent the movement of the Unit impacting the child Actors.

That would be the opposite, top_level makes a node ignroe its parents

Yes, so to avoid Units movement affecting Actor I am setting Actor.top_level = true. Sorry if I’ve misunderstood something.

I’d suggest not moving Unit if it has actors under it, or just not have that hierarchy

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.