Jump to content

How to rotate arcade object


Michał Lipa
 Share

Recommended Posts

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

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

 Share

  • Recently Browsing   0 members

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