how to Get the diagonal position upper left of sprite.

how to Get the diagonal position upper left of sprite independent of rotation

remembering that the sprite is a square.

Hey, you can get the upper left of a sprite by combining Sprite Extents.


So the X extent is the right-most point of the sprite, so the -X extent is the left-most point of the sprite. And the Y extent is the up-most point of the sprite.


You can combine these together to get the upper-left extent, such as below I did it by combining them into a Vector2:


SpriteRenderer sr = GetComponent<SpriteRenderer>();
Vector2 upperLeft = new Vector2 (-sr.bounds.extents.x, sr.bounds.extents.y);

Hope that helps!

@StevenMitchell i need get the position upper left of a sprite with rotation, because i want spawn the prefab 'attack wave ’ in tip of sword position,some swords are bigger than others and he(sword)
They are spinning because of the attack animation