- Home /
How to find the bottom position of a Image based on it's height?
I want to find the exactly rect transform position.y that represets the bottom of the image based on it's height.
,I need to know the exactly rect transform position.y of a Image but I don't want the middle of the image, I want the bottom position based on it's height.
Answer by Omti1990 · Nov 09, 2020 at 06:22 PM
It's actually very easy. That would be float y = rectTransform.position.y - rectTransform.sizeDelta.y *0.5f;
. You get the center of the image. Take the y coordinate. Then you get the y of the sizeDelta of the image and divide that by two. Than you subtract that from the center y coordinate. That should get you the bottom y of your image.
Answer by lvskiprof · Nov 09, 2020 at 06:42 PM
If you know the height and you know the midpoint then the bottom is midpointY - (height / 2).