Sign in to follow this  
Estauns

2D Draw Position - What point is best?

Recommended Posts

Estauns    103
What do you think the best "draw position" is? It seems like if you mark all rectangles / bounding boxes from the top left corner of the sprite, you'd get some pretty funky results. Storing it from the middle seems more natural to me, but then you have like a -16, 16 width box and that's probably not a good idea. What about from the feet in the middle? Is there any one position that's best to used?

Share this post


Link to post
Share on other sites
markr    1692
It needs to be decided entirely on a case-by-case basis.

In a lot of cases, the middle is a convenient "hotspot" - for things like explosion billboards, projectiles etc.

But in other cases, the top or bottom middle is more suitable - for example, things which "stand up" from the floor (in a platformer for instance), the bottom middle seems like a good choice for hotspot.

Likewise, the top middle could be used for things which "hang" from the ceiling.

Plus also, grid-aligned objects would normally choose the corner.

It entirely depends what you're doing, and could easily vary for different objects in the same game.

Mark

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this