Jump to content

Sprite bodies not following sprite angle


Recommended Posts

game.add.tween(ship).to({ angle: 110 }, 1000, Phaser.Easing.Quadratic.InOut, true, 500);

I rotated the sprite in the above example but the body doesn't follow. Can be seen with the code below


Is this fixed in the latest 1.07?

Link to comment
Share on other sites

Hi rich,


This is the original angle. I did game.debug.renderSpriteBody(); to check their bounding area.




When I rotated the 1st ship, the body did not rotate together with the sprite. The collision works but I would like the 1st ship front to collide.



Link to comment
Share on other sites

Yes, this is expected behaviour. As I said the sprite bodies are fixed to AABB (axis-aligned bounding boxes) only. You can adjust the offset of them and the size of them, but they won't rotate in an AABB system. For that you need a more advanced physics system (like Chipmunk or Box2D) or wait for us to finish our own version, but this is months away yet really.

Link to comment
Share on other sites

  • 6 months later...

Sorry to bring up this old post, but this is exactly what I am working on right now. I understand that Phaser's arcade physics uses AABB, and that can't be rotated. That makes sense and is fine. However, it would be great if there was a way to get a new bounding box of that rotated sprite. For example, getting something similar to the red box for my purposes:




The rotated white box is what we can't have in the arcade system, but can we get the red box to be used as a sprite's body shape?


Note: The screenshot not from Phaser, just another similar project I was working on.

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.

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.


  • Recently Browsing   0 members

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