Jump to content

[P2] Rotation and anchor point


Recommended Posts



here is my Weapon "class" :

function Weapon(game, x, y, sprite, hero){    Phaser.Sprite.call(this, game, x, y, sprite);    this.anchor.setTo(.5, 1);    this.game.physics.p2.enable(this, true);    this.body.motionState = Phaser.Physics.P2.Body.KINEMATIC;    this.using = false;    this.hero = hero;}Weapon.prototype = Object.create(Phaser.Sprite.prototype);Weapon.prototype.constructor = Weapon;

I don't get why when I rotate it with

this.body.angle -= 0.1;

the sprite rotate from it's middle and not from (0.5, 1) anchor point ?


Any ideas ?

Link to comment
Share on other sites


  • Recently Browsing   0 members

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