godot: Cannot draw in global space from a child node
Godot 2.0.3, Windows 10, 64 bits
I am trying to use _draw()
to display a sort of particle system in global space, because the ParticleSystem2D is not suited for my case.
I don’t want to move my node to the root because I prefer to have it part of my objects, so I am using this workaround to counter all local transforms:
var inv = get_global_transform().inverse()
draw_set_transform(inv.get_origin(), inv.get_rotation(), inv.get_scale())
It appears to work, but if I scale the parent node the position is incorrect. Here is a minimal project showing the issue: GlobalSpace.zip
Is this a bug? Or am I doing something wrong?
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 32 (32 by maintainers)
so, is this still a bug? I also don’t want to state the obvious but you could put the node with the shoots at a higher hierarhcy too 😛
I used
draw_set_transform_matrix(get_global_transform().affine_inverse())
and-2,2
scale for the Sprite. It is drawing in the correct place:@Zylann this PR fixes the build problem: #5434