Jump to content

Sprite angle disconnects image from its arcade body


QLNEO
 Share

Recommended Posts

5980882bc75e5.png

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

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

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

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!

59808c65e7b74.png

(I could use syncBounds to make it more accurate but for my purposes that's already fine)

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...