fancyoung Posted April 25, 2017 Share Posted April 25, 2017 In my code, I use center as 0, 0. My other coordinate are all right, but when I use `getBounds` to get a curve's bound, the return value is incorrect. It seems the x,y is relative to top-left instead of center. Why? How can I get the correct coordinate? Quote Link to comment Share on other sites More sharing options...
Taz Posted April 25, 2017 Share Posted April 25, 2017 Using the top left corner as the origin is common for 2D computer graphics, but you can convert the bounds like this: var bounds = sprite.getBounds(); bounds.x -= renderer.width / 2; bounds.y -= renderer.height / 2; Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted April 26, 2017 Share Posted April 26, 2017 You can use getLocalBounds() Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.