- Home /
How do you get the world-space position of a sprite with a custom pivot?
Hello, I'm currently building a project using Unity 4.6.1 p5.
I have a sprite with its center pivot offset by a small amount in the sprite editor, and I need to align other objects with the true center of the sprite, not the offset pivot point.
As far as I can tell, neither SpriteRenderer nor Sprite have any properties which pertain to the actual sprite's location in the world, only data relative to the custom pivot point.
Does anyone know a way to find/calculate the sprite's actual world position?
Thanks
Answer by komodor · Jun 17, 2015 at 10:18 PM
http://docs.unity3d.com/ScriptReference/Renderer-bounds.html might do the trick
Unfortunately the Renderer Bounds also point at the custom pivot as the center.
Renderer.bounds.center == obj.transform.position
Your answer
Follow this Question
Related Questions
Change Rotation Pivot without Affecting Position 1 Answer
Instantiated Game Object is at the wrong location. 1 Answer
center of object group 0 Answers
Please help finding center of object 1 Answer