fela98 Posted November 6, 2014 Share Posted November 6, 2014 Hi, I'm relatively new to Pixi. I have a problem similar to the one mentioned in this post:http://www.html5gamedevs.com/topic/5766-bunny-drag-example-with-correct-mouse-offset/?hl=%2Bdrag+%2Bpixi I used the code from the post and it worked seamlessly. However, when i began rotating the Sprites the offset became wrong, and the sprite jumps to another location when i begin dragging it. Do i have to use some trigonometric function to reverse the rotation? How can I do this? Here is a version with rotation:http://jsfiddle.net/cXfpq/2/ Here without rotation:http://jsfiddle.net/dirkk0/cXfpq/ Thanks in advance! Felix Quote Link to comment Share on other sites More sharing options...
alex_h Posted November 7, 2014 Share Posted November 7, 2014 I think this is because you are using the value returned by calling the 'getLocalPosition' method of the interaction data. If you just use the iData.global property instead that gives you the position of the interaction relative to the stage, thereby ignoring any rotation transforms applied to the sprite itself. Quote Link to comment Share on other sites More sharing options...
fela98 Posted November 10, 2014 Author Share Posted November 10, 2014 Thanks! It worked really well, I didn't know that this property existed. Guess this was just me being stupid. However thanks for the help! 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.