d13 Posted June 17, 2015 Share Posted June 17, 2015 Apparently there is new `getGlobalPosition` method on display objects: https://github.com/GoodBoyDigital/pixi.js/issues/796 ... but it doesn't seem to be in the documentation: http://pixijs.github.io/docs/PIXI.DisplayObject.html Can anyone out there explain how to use it?I've tried code like this: console.log(anySprite.getGlobalPosition());Which produces this:[object Object]Any help would be much appreciated! Quote Link to comment Share on other sites More sharing options...
Sawamara Posted June 18, 2015 Share Posted June 18, 2015 .x, .y properties of the object, maybe? : ) Quote Link to comment Share on other sites More sharing options...
xerver Posted June 18, 2015 Share Posted June 18, 2015 .x, .y properties of the object, maybe? : ) Exactly that: https://github.com/GoodBoyDigital/pixi.js/blob/07e4e26f8fd404524a7ebaa73c210de3d8f2cf25/src/extras/getGlobalPosition.js#L3-L27 Quote Link to comment Share on other sites More sharing options...
d13 Posted June 20, 2015 Author Share Posted June 20, 2015 Thanks! I just want to confirm: Will `getGlobalPosition` return the accurate values for the current frame?Is that what this bit of code does?this.displayObjectUpdateTransform(); (In previous versions of Pixi worldTransform.tx and worldTransform.ty were always one frame behind the sprite's current local x/y position, and that made many types of collision detection for games very difficult or inaccurate.) Quote Link to comment Share on other sites More sharing options...
xerver Posted June 20, 2015 Share Posted June 20, 2015 Yes, it will run a transform update to it is accurate. Normally tx/ty are from the previous frame, calls to these methods force an update so they are accurate. d13 1 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.