## Recommended Posts

Hello everyone,

I've started to experience some glitches with the arcade physics system. Here is the game, so you can experience the problems yourself, and the GitHub if you'd like to look at the source:

preece.github.io/Frauki

https://github.com/Preece/Frauki

1) When the characters velocity is high and they are pushing against a wall, they tend to fall through the floor. As I lessen the velocity, I can see them start to dip down into the geometry of the world, and then pop back up at the last second. For example, if you walk against a wall (arrow keys), then roll (x), you will dip into the geometry a little bit. If you roll and then immediately attack (z) you will do a stab. This stab moves you quite fast, and for me, drops me through the floor almost every time.

One possible contributing factor is that I am tweening a variable to have a certain shape of change, and while they are in one of these states I keep their velocity locked to that value. Could this have something to do with the problem?

Tween on the motion of this.movement.rollVelocity (to which x velocity is entrained):

`this.tweens.roll = game.add.tween(this.movement).to({rollVelocity: dir * PLAYER_ROLL_SPEED()}, 50, Phaser.Easing.Exponential.In, false).to({rollVelocity: dir * PLAYER_SPEED()}, 300, Phaser.Easing.Quartic.In, false);    this.tweens.roll.start();`

PLAYER_SPEED() and PLAYER_ROLL_SPEED() are on the order of 700-1400

2) After upgrading to 2.2, the character "bounces" in a strange way when they land, but only sometimes. If I watch the y velocity, it goes to 0 when they hit the ground, as expected, but then spikes to 13.333 a few times. When you crouch the character (down arrow), it does the same thing but for occasional single frames it goes to 26.666 on some frames, and 13.333 on others. This leads to a weird sort of bouncing. If you open the console right now, it will simply print the y velocity every frame so you can see this happening.

3) I am using the camera function FocusOnXY to move the camera around relative to the character. In this way I am getting a more complicated type of movement out of it that is not just locked to the character. After the upgrade, it seems to be somewhat choppy, as if it is not updating as fast as the character is. I suspect this is due to the decoupling of the update loops and the physics system. I wonder if there is a way around this?

For any insight you are able to give, I am extremely grateful. Thank you. If you need any additional information from me, please let me know.

##### Share on other sites

Just to say please try 2.2.3 which you can get from github in the dev branch. This fixes a serious issue with the new fixed-step system and Pixi.

That aside, it may still not solve the actual problem - but I would certainly start with it and see how many issues still manifest after.

##### Share on other sites

That seems to resolved 2/3 issues! Excellent! The remaining one existed before 2.2 (but IIRC not before 2.0). Thanks Rich. Any thoughts on the remaining one (falling through the floor at high speeds)?

##### Share on other sites

Ahh I'm pretty sure it's just tunnelling

I need to have a think about how we could handle that, it really bugs me too.

##### Share on other sites

Would it be possible to put a flag on the arcade body that would cause it to change the exact method of its collision detection like this:

Instead of checking only the delta position of the body, it would instead check each position pixel by pixel. So, if the bodies velocity would propel it forward 10 pixels, instead of just checking the collision of the body moved forward 10 pixels, it would check 10 times, moving the body 1 pixel each time.

I realize this is far more expensive, but my thinking is that if there was just a flag that sent something into this mode, it could be used sparingly. For instance, I would only need to turn this flag on as the character was rolling or doing something that caused her to move exceptionally fast.

##### Share on other sites

Or perhaps, move the body forward in increments of the width/height of the bounding box. Then, if a collision is found, you could revert to the previous increment and go pixel by pixel.

##### Share on other sites

Hmm looks like the problems are all back... Was 2.2.3 removed from the dev branch? When I load it says 2.2.2-dev.

##### Share on other sites

• 2 weeks later...

I tried to write a simple game with Phaser 2.2.1 but my character easily fell through the floors. If you jump about 30 times at least one time he'll fall through the platform. It worked well with Phaser 2.0.1.

I had to adjust game.physics.arcade.OVERLAP_BIAS from the default of 4 to 10 to make this go away. It doesn't seem like a very satisfactory solution though but at least I don't have to throw my work away or port to another game engine. For now at least.

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.