Is there something similar to Particle2d's LocalCoords property for other nodes?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Socrates

I’m making hand-drawn animated explosion-like effects for a 2D game. When making a Particle2D effect there is a property called LocalCoords that you can set to true or false to make the particle effect use local or global coordinates. Is there anything similar for other nodes, or how would i go about doing this? I can make the explosion effect a child of the root node but ideally i’d like it to work like Particle2D does.

:bust_in_silhouette: Reply From: Zylann

There is no inspector toggle for nodes to use world space, however it’s possible to draw in world space from GDScript, by doing something along those lines:

func _draw():
    # "undo" local transform
    draw_set_transform_matrix(global_transform.affine_inverse())

    draw_line(...)
    # etc

Another way is to introduce an extra Node parent (that one has no transform), which “cuts” the relation with the parent Node2D and makes the child use world space.