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

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

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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