I have found some information on this topic but I still couldn’t get it to work and fully understand it.
I have a sprite that is rotated. Now I want to scale that sprite but independantly from the current rotation. It should be scaled like the rotation is always 0°.
I have a 2D Vector that should squish the object on collision. It contains a scaled value from the collision vector. So the problem is because my sprite is rolling around that I can’t just apply that vector on the current size. (If I hit the floor the sprite is always squished by X% on the Y-axis with the current rotation).
I’ve tried the following but only got weird results:
In other engines you would solve this problem by modifying the transformation matrix. Afaik this is not possible with unity.
But there is a workaround which is pretty straight forward:
Place your object (child) into another empty game object (parent).
use the parent for translation and scale. use the child for rotation.
I’m afraid I can’t do that. The object is moving constantly. If the position of the parten object doesn’t match the position of the child than the scaling of the parent will move the child as soon as the positions are different. I can’t set the position of the parten object to the same as the child becaue that would again move the child objects. So I have a paradox that my parent would need to be the child of the object as well. Parten for scaling, child for positioning.
To make it clear:the object I want to scale is physics based. So I can’t simply split position from rotation.
Hey Good_Punk - if you’re not relying on things like collisions on this object, this sounds like a job for a vertex shader! Have you looked into those at all?