Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Substr |
I’m trying to work out how to programatically apply Y-axis scaling to a sprite that has been rotated, but apply the scaling along the original/screen axis and not the rotated local one.
I’ve tried various combinations of modifying rotation_degrees
and scale
or using a Transform2D
to attempt to apply the rotation and then scale in order, but nothing seems to give the result I want. I’ve included some badly drawn diagrams to try and explain what I’m after, using an example of a square and a 45 degree rotation. I may be missing something obvious but I’d appreciate any pointers in the right direction to get the intended result.
What I currently get:
What I want:
Have you tried global_scale?
Magso | 2020-02-15 16:46
Yeah, I tried that too though I don’t fully understand what the difference is, as it gives the same result as the first picture.
Substr | 2020-02-15 16:51
What if you put the sprite inside a parent node2d. Only apply rotation to the sprite, but when you scale, change the y scaling of the parent node.
It’s more of a workaround than a real answer, but it might work.
denxi | 2020-02-15 16:54
try global_scale?
https://docs.godotengine.org/en/stable/classes/class_spatial.html#class-spatial-method-global-scale
rakkarage | 2022-03-14 18:52