Michał Lipa Posted June 5, 2017 Share Posted June 5, 2017 I'm creating a simple multiplayer game. I have got problem with rotating other players objects, if there are using arcade physics.Rotation works well without arcade physics, but I need to make work collisions and rotation so don't know how to handle that. //Online player object this.tank = game.add.sprite(x, y, 'tank'); game.physics.enable(this.tank, Phaser.Physics.ARCADE); //Changing rotation - updating all players rotation in loop player.tank.rotation = p.tankRotation; Why this doesn't work? I also tried with: player.tank.rotation = p.tankRotation; player.tank.body.rotation = p.tankRotation; player.tank.angle = p.tankRotation; player.tank.body.angle = p.tankRotation; Link to comment Share on other sites More sharing options...
Arcanorum Posted June 5, 2017 Share Posted June 5, 2017 Arcade physics bodies can't be rotated. You will need to use a more comprehensive physics engine for that, such as P2. Link to comment Share on other sites More sharing options...
snowbillr Posted June 5, 2017 Share Posted June 5, 2017 I'm pretty sure you can rotate objects using Arcade physics, at least that's how it looks according to the documentation. http://devdocs.io/phaser/phaser.physics.arcade.body There are allowRotation, a bunch of angular* properties, and a rotation property. So things can be rotated, BUT the documentation for the rotation property says that the collision box never rotates. So you'll see the picture of the Sprite rotate, but the collision hit box will not. At least, that's what it seems like. Link to comment Share on other sites More sharing options...
samme Posted June 5, 2017 Share Posted June 5, 2017 If you're up for it, you can use Arcade Physics for the preliminary collision and then run a precise test yourself: SAT.pointInPolygon(). Link to comment Share on other sites More sharing options...
Recommended Posts