Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

Arcade physics bodies, not colliding properly.


Recommended Posts

Basically, I have physics and collision enabled on my player and another sprite (log).


In create(),

    this.log = this.game.add.sprite(750, 600, 'obstacles', 'log.png');    this.logTween = this.add.tween(this.log).to( { y: 100 }, 2000, "Linear", true, 0, -1, true);      this.game.physics.arcade.enable(this.log);    this.log.body.immovable = true;
    this.player = this.game.add.sprite(this.game.width/2, this.game.height/2, 'player', 'front.png');       this.player.scale.setTo(0.5, 0.5);    this.game.physics.arcade.enable(this.player);    this.player.body.gravity.y = 500;

And in update function,


    this.physics.arcade.collide(this.player, this.log);



I expected the player to stand on the moving log, but he passes right through. There's a little collision but he never stands on the log. Always passes through.

Link to comment
Share on other sites



try to comment your tween and check whether the collision works. Tweens and physics are not the best friends.



yeah then it works. But I have to tween.yoyo this log. And other assets that are moving back-n-forth. 


If I try to move a physics-enabled Sprite and also set body.moves to false, will that take care of artefacts?

Link to comment
Share on other sites


  • Recently Browsing   0 members

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