Jump to content

DeltaY vibrating bug


Bazgir
 Share

Recommended Posts

Hello,

While trying to optimize my game, I came across a rather unusual bug. When the player's sprite is touching the ground, the sprite's deltaY shoots up and down very rapidly, manifesting as a very subtle to sometimes quite obvious vibration. When the player is touching anything else from below except the ground, the issue goes away.

In the video below, nearing the end you can see the sprite vibrating. I've changed the collision boxes of the ground and the player to be higher/lower to demonstrate collision regardless of the sprite's actual position.

The ground as well as the table are both in the same group, and physics as well as any other properties are applied to the group instead of the sprites. I've also tried the reverse, with no change to the bug.

 

create: function() {
   ...
   this.obstacleElements = this.add.group();
   this.obstacleElements.enableBody = true;
   this.obstacleElements.physicsBodyType = Phaser.Physics.ARCADE;
   this.obstacleElements.immovable = true;
   this.ground = this.add.tileSprite(0, (this.rows-1)*this.tileSize, this.game.world.width, 60, 'floor');
   this.obstacleElements.add(this.ground);
   ...
   ...
   this.player = new MrHop.Player(this, {
         row: 3,
         col: 1,
         asset: 'player',
         type: 'protag',
         health: this.playerStats.health,
         attack: this.playerStats.attack,
         defence: this.playerStats.defence,
         speed: this.playerStats.speed
   });
   this.player.enableBody = true;
   this.game.physics.arcade.enable(this.player);
   ...
},

update: function() {
   this.game.physics.arcade.collide(this.player, this.obstacleElements);
   ...
},

edit: for some reason the video thumbnail is sped up, but proceeding to the direct link seems to work fine. I've also attached a copy of the video directly to the post.

 

Edit#2: Further testing has found that the issue only exists if the ground has the player sitting between Y:163 to Y:215. if I set the ground to be 162 or 216, the issue goes away.

Edit#3: Even more testing has found that it's something to do with the player sprite itself. Changing the player's scale or hitbox size/location radically enough causes the bug to go away. I'm not sure why the bug was happening, but as these are placeholder models I'm not going to worry too much about it until I've implemented the proper sprites.

Thanks

deltaYbug.webm

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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