walfin Posted May 10, 2020 Share Posted May 10, 2020 I am trying to rotate a Sprite. However, it rotates around the 0,0 of the world instead. I have tried translating it back to 0,0, rotating it, then translating it back to the original x,y again, but it still did not work. How do I rotate a Sprite around its current position? Quote Link to comment Share on other sites More sharing options...
01271 Posted May 17, 2020 Share Posted May 17, 2020 How are you doing the rotation? Could you share the code for the sprite including the movement code for it? Also are you rotating it with radians instead of degrees? Quote Link to comment Share on other sites More sharing options...
walfin Posted May 26, 2020 Author Share Posted May 26, 2020 I solved the problem by nesting the sprite in 2 Containers. Clunky, but whaddya know, it works. Quote Link to comment Share on other sites More sharing options...
obiot Posted May 26, 2020 Share Posted May 26, 2020 That’s weird, this should work, i use it all the time ... at least i think ? (After checking all my examples) indeed all my usage are mainly when the sprite is a child of an entity or a container, i’ll setup a quick test tomorrow, maybe something broken somewhere Quote Link to comment Share on other sites More sharing options...
obiot Posted June 9, 2020 Share Posted June 9, 2020 Hi, so... https://github.com/melonjs/melonJS/commit/72cde7948d5d913ac79f244e86b1eb248e2752e0 not sure how that happened, but certainly some previous code optimisation poorly tested, but unfortunately it's not that easy to add an automatic test unit for it 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.