mikeredhorse Posted November 3, 2013 Share Posted November 3, 2013 Hello. I've been trying to work on a project using Pixi.js and have hit a bit of a snag. I've used addChild to add a sprite offset from another sprite, similar to a moon orbiting around a planet. This works fine for displaying as usual, however I now need the moon's position on the screen, in order to use the graphics module to draw some lines directly. However moon.position returns the local offset from the parent planet. Couldn't find anything in the documentation, and looking through the source I assume I have to use the sprite's worldTransform somehow. I don't know how nice that'd play with multiple levels of children, however. Any help is appreciated. EDIT: Of course, as soon as I post about it, I end up figuring it out by myself. moon.worldTransform[2] is the x position, moon.worldTransform[5] is the y position. A convenience function for getting the global position would be nice though, or at least a mention of worldTransform in the docs. Quote Link to comment Share on other sites More sharing options...
benny! Posted November 3, 2013 Share Posted November 3, 2013 ... A convenience function for getting the global position would be nice though, or at least a mention of worldTransform in the docs. +1 P.Uri.Tanner 1 Quote Link to comment Share on other sites More sharing options...
Mat Groves Posted November 3, 2013 Share Posted November 3, 2013 Good call guys. Actually looking for someone to help out with the pixi.js docs at the moment as writing is unfortunately not one of my strong points :/ 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.