QLNEO Posted August 1, 2017 Share Posted August 1, 2017 What the title suggests. When I change a sprite's angle (via its angle property, rotation yields the same results), the sprite image rotates about its origin point, while the collision box stays in place. I tried changing the `pivot` property, but while that indeed fixes the sprite image movement, now the collision box itself moves to "correct" that, and their relative distance is the same (but now with the collision misplaced, which is even worse). Is there a way to change sprite pivot without it affecting the collision box? Link to comment Share on other sites More sharing options...
rich Posted August 1, 2017 Share Posted August 1, 2017 Arcade Physics bodies cannot rotate (they are AABB, so axis aligned). If you need a rotating physics body you need to use P2. Link to comment Share on other sites More sharing options...
QLNEO Posted August 1, 2017 Author Share Posted August 1, 2017 Hi Rich. I don't actually want the body to rotate with the sprite, I'm aware that Arcade Physics locks its rectangle to the axis. What I need is the sprite image to rotate in place, relative to the collision box, which isn't happening right now. Link to comment Share on other sites More sharing options...
rich Posted August 1, 2017 Share Posted August 1, 2017 If you anchor 0.5 the sprite and then use the Body offset command to make sure it's in the right place then it would rotate from the center of the Body without needing further changes. You could also use the body to rotate the sprite via its angular velocity properties. Link to comment Share on other sites More sharing options...
QLNEO Posted August 1, 2017 Author Share Posted August 1, 2017 Turns out anchor is all I needed! I missed that pretty easily, went for pivot instead, which was causing me problems. Now it looks just fine. Thanks for your help! (I could use syncBounds to make it more accurate but for my purposes that's already fine) Link to comment Share on other sites More sharing options...
Recommended Posts