Godot Version
4.2
Question
Hello =)
I am trying to display my sprite in the correct order with the “Y sort enable” function. However, the center is in the middle of the sprite. I saw I can correct it by changing the offset of the sprite2D.
But, I need to do it by script. I have an instantiated object that grows thus I need to change its size after instantiation. I tried to adjust the offset ($Sprited2D.offset.y = newvalue).
but by doing so, the sprite changes position in the main scene, and the rigidbody stays at the same place.
How can I change the Sprite2D offset without changing its position in the main scene?