shabeerahmedshah Posted April 30, 2016 Share Posted April 30, 2016 Why is that the getBounds() of item doesn't return true bounds of that item in case of parent stage having a modified scaling? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted April 30, 2016 Share Posted April 30, 2016 What do you mean? In other engines transform = projection * worldTransform . and both projection and world bounds are calculated. Pixi doesnt have that yet, Quote Link to comment Share on other sites More sharing options...
shabeerahmedshah Posted April 30, 2016 Author Share Posted April 30, 2016 What I basically need is to draw a graphics rectangle on sprite to make it feel like selected. So I called sprite.getBounds() and use those values to draw the graphics rectangle. It works fine when the parent container has 1:1 scale. but the rectangle moves forward from the sprite when scaling increased and vice versa. Quote Link to comment Share on other sites More sharing options...
shabeerahmedshah Posted April 30, 2016 Author Share Posted April 30, 2016 BTW if we can transform = projection * worldTransform, can we get the local transform of an object? though I could'nt find localTransform or transform property on a sprite. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted April 30, 2016 Share Posted April 30, 2016 I dont know why do you think it must have telepatic interface that determines which coords you actually need. You need bounds inside the parent container, not global bounds. pixiv3: getBounds(parent.worldTransform) pixiv4: getBounds(parent.transform.worldTransform) or just divide by that scale Quote Link to comment Share on other sites More sharing options...
shabeerahmedshah Posted April 30, 2016 Author Share Posted April 30, 2016 Yes, I am using scale divide strategy for now. Thanks for help bro. 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.