Let’s say I have a background sprite, and I want a script to calculate what Y position is considered to be at the lower border of the sprite, so I can make top-bottom calculations (like adding the positive value of that position in between calculations so I can consider the bottom of the background to be Y 0 even if it isn’t)
I can think of two ways to do it, one move the sprites pivot point to the bottom so when you call its transform the position is at the bottom, or you can get the sprites bound, then take the transform pos and minus the bound y size /2 should also give you the bottom y pos assuming the pivot is in the center
1 Like
Thank you! I didn’t know about the “bounds” porperty, so I researched, and I found there is a “.bounds.min.y” in an object’s sprite renderer that gets the Y position at the lower border. That’s what I needed, thanks for the ideas!
1 Like