4ucai Posted October 9, 2013 Share Posted October 9, 2013 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 belowgame.debug.renderSpriteBody(battleShip);Is this fixed in the latest 1.07? Link to comment Share on other sites More sharing options...
rich Posted October 9, 2013 Share Posted October 9, 2013 Bodies don't rotate, it's an AABB collision system (not OBB). Or did you mean it didn't follow the sprites x/y coordinate either? Link to comment Share on other sites More sharing options...
4ucai Posted October 10, 2013 Author Share Posted October 10, 2013 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 More sharing options...
rich Posted October 10, 2013 Share Posted October 10, 2013 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 More sharing options...
4ucai Posted October 10, 2013 Author Share Posted October 10, 2013 Ah I understand, no problem. Still has solutions, and I just need to polish my math on adjusting the body. Thanks rich. Link to comment Share on other sites More sharing options...
rich Posted October 10, 2013 Share Posted October 10, 2013 Yeah you can disable the body fully now in 1.0.7-dev (just set it to null) and then let a different physics system take control of the updates for you. Link to comment Share on other sites More sharing options...
4ucai Posted October 10, 2013 Author Share Posted October 10, 2013 I'll w8 for the official release and dig my way through the codes. I saw the beta release has documentation. Thanks rich Link to comment Share on other sites More sharing options...
jackrugile Posted April 24, 2014 Share Posted April 24, 2014 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 More sharing options...
Recommended Posts