# Sprites Falling Through the Floor

**URL:** <https://phaser.discourse.group/t/sprites-falling-through-the-floor/8679>\
**Category:** Phaser 3\
**Created:** [January 18, 2021, 5:55pm UTC](https://phaser.discourse.group/t/sprites-falling-through-the-floor/8679 "2021-01-18T17:55:08Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![t\_rev44](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/t_rev44/32/4157_2.png) [@t\_rev44](https://phaser.discourse.group/u/t_rev44)\
**Post date:** [January 18, 2021, 5:55pm UTC](https://phaser.discourse.group/t/sprites-falling-through-the-floor/8679/1 "2021-01-18T17:55:08Z")

</div>

Hi,

After weeks of trying to resolve this issue, I still have instances of my game character falling through the floor. I understand this happens when the collision happens in between frames, if the player experiences a frame drop due to limited cpu resources, is this problem unavoidable? Is a low frame rate the only thing that could cause this?

I’ve tried:

- setting the player’s max Y velocity to 900
- setting the overlapBias and tileBias to 32, which is the size of my tile sprites

my game:

> **[Fact Blast by t-rev](https://t-rev.itch.io/factblast)**
>
> FACT BLAST! - Help Jeremy from Geeks and Gamers save the internet!

---

<div class="post-metadata">

**Author:** ![samme](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/samme/32/5275_2.png) [@samme](https://phaser.discourse.group/u/samme)\
**Post date:** [January 18, 2021, 6:55pm UTC](https://phaser.discourse.group/t/sprites-falling-through-the-floor/8679/2 "2021-01-18T18:55:07Z")

</div>

If you’re using fixed-step Arcade Physics (the default) I don’t think frame dropping could cause the problem.

It can happen if velocities are very large or the bodies/tiles are very small. But that doesn’t look like the case in your game, unless the ground is very thin.

It can also happen if you place bodies directly overlapping each other, especially with zero velocity.

When do you see the problem?

---

<div class="post-metadata">

**Author:** ![t\_rev44](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/t_rev44/32/4157_2.png) [@t\_rev44](https://phaser.discourse.group/u/t_rev44)\
**Post date:** [January 18, 2021, 10:18pm UTC](https://phaser.discourse.group/t/sprites-falling-through-the-floor/8679/3 "2021-01-18T22:18:06Z")

</div>

I have arcade physics and fixedStep set to false. When it was set as true, all the movement was super choppy. The ground at its thinnest is 32 pixels.

Sorry I should have clarified, it happens randomly when the player is airborne, either jumps or gets hit and is falling, then when they should land on the ground, they fall through it. They don’t fall through after standing or running.

I haven’t been able to re-create the issue in a long time, but a user in my comments said it happened and I believe them because I used to see it a lot. Setting the tileBias seemed to make it stop for me, but I guess it’s still happening.

---

<div class="post-metadata">

**Author:** ![kittykatattack](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/kittykatattack/32/3888_2.png) [@kittykatattack](https://phaser.discourse.group/u/kittykatattack)\
**Post date:** [February 2, 2021, 5:46pm UTC](https://phaser.discourse.group/t/sprites-falling-through-the-floor/8679/4 "2021-02-02T17:46:31Z")

</div>

Hello!

I’m actually experiencing a similar problem. When my game falls to 30fps or lower, my platform character occasionally falls through my 16px tile floor. This happens when the character falls onto the floor, or jumps onto it. So, my guess is that its velocity is too high, and overshoots the 16px bounding box.

So I have a few questions for any experienced users about this:

- Is it possible fix the physics timestep at 60, even if the fps falls to 30. (Or, are they linked? I have `fixedTimestep` set to `true`, which seems to lock the physics update to the fps)

- Is it possible to increase the collision bias? I noticed there’s a `collisionBias` option in the arcade physics config, but setting this ether higher or lower than 4 seems to make no difference. Does anyone have an idea of exactly that this does? (Have read the docs, but I’m still not sure: [Phaser 3 API Documentation - Class: World](https://photonstorm.github.io/phaser3-docs/Phaser.Physics.Arcade.World.html#OVERLAP_BIAS)) What kind of numbers would I need to test to see an effect?

Thanks!

---

<div class="post-metadata">

**Author:** ![samme](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/samme/32/5275_2.png) [@samme](https://phaser.discourse.group/u/samme)\
**Post date:** [February 2, 2021, 8:34pm UTC](https://phaser.discourse.group/t/sprites-falling-through-the-floor/8679/5 "2021-02-02T20:34:20Z")

</div>

The physics step size is fixed by default. It’s variable only if you set `fixedStep: false` in the physics config or `this.physics.world.fixedStep = false`.

So if you have fixed step on (the default) I don’t think a low frame rate by itself should cause a separation failure. There may be something else going on, maybe in your scene `update()` or collision callbacks.

You can increase `tileBias` (for sprite vs. tile) or `overlapBias` (for sprite vs. sprite) in the physics config. I would start by doubling the value.

---

<div class="post-metadata">

**Author:** ![Telinc1](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/telinc1/32/60_2.png) [@Telinc1](https://phaser.discourse.group/u/Telinc1)\
**Post date:** [February 3, 2021, 11:02am UTC](https://phaser.discourse.group/t/sprites-falling-through-the-floor/8679/6 "2021-02-03T11:02:37Z")

</div>

> [@samme](#):
>
> So if you have fixed step on (the default) I don’t think a low frame rate by itself should cause a separation failure.

Yes, the (default) fixed time step is exactly what prevents these problems. If `fixedStep` is `false`, the physics engine will use the render FPS, which can make it behave unpredictably.

Keep in mind that physics engines tend to break if run at a low enough FPS (I don’t think there’s an exact way to quantify it). Arcade runs well at 60 FPS, but that’s not always enough in certain cases. With a variable time step, you have no control over the FPS of the engine, so you also can’t control whether it works correctly.

> [@samme](#):
>
> There may be something else going on, maybe in your scene `update()` or collision callbacks.

That’s a good idea, and it reminded me to ask something. Is your collision handled by colliders (`physics.add.collider`) or do you check for collision manually in `update()` (with `physics.collide`)? Colliders will use the physics FPS, preventing these problems if the engine uses a sufficiently fast fixed time step. Manual updates use the render FPS, which can cause problems if it doesn’t quite sync up with the physics FPS.

If your physics run with a fixed time step, you’re using colliders, and the bias options samme suggested doesn’t help, you can also try to increase the [physics FPS](https://photonstorm.github.io/phaser3-docs/Phaser.Types.Physics.Arcade.html#.ArcadeWorldConfig).

---

<div class="post-metadata">

**Author:** ![kittykatattack](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/kittykatattack/32/3888_2.png) [@kittykatattack](https://phaser.discourse.group/u/kittykatattack)\
**Post date:** [February 3, 2021, 2:01pm UTC](https://phaser.discourse.group/t/sprites-falling-through-the-floor/8679/7 "2021-02-03T14:01:57Z")

</div>

@samme and @Telinc1 Thanks both so much for your helpful and detailed replies! I’m busy doing some more testing based on your feedback and will report back soon! 🛩

Just one question for you @Telinc1, how can I increase the “physics FPS”? (is this different to the `fps` property in the config?)

---

<div class="post-metadata">

**Author:** ![kittykatattack](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/kittykatattack/32/3888_2.png) [@kittykatattack](https://phaser.discourse.group/u/kittykatattack)\
**Post date:** [February 3, 2021, 3:24pm UTC](https://phaser.discourse.group/t/sprites-falling-through-the-floor/8679/8 "2021-02-03T15:24:51Z")

</div>

@samme @Telinc1 I’ve run some more tests and have an update on this:

My physics config looks like this:

```javascript
physics: {
    default: "arcade",
    arcade: {
      gravity: { y: 2000 },
      debug: false,
      overlapBias: 8,
      tileBias: 32,
      fps: 60,
      fixedStep: true
    }
  },

```

If the game’s rendering fps is between 40-60fps, all is well, no fall though. If on a slow machine the rendering fps drops to around 30, floor collisions can be missed, and the game character falls through the floor.

But, my understanding of `fixedStep: true` is that the physics timestep should remain locked at 60fps, even though the render fps falls below that. If that’s correct, it doesn’t seem to be working in my case for some reason.

@Telinc1 Just confirming that my collisions are handled by colliders (`physics.add.collider`), which, if I understand correctly, should sync with the physics fps. However, my colliders _do_ reference sprite properties (x and y) that are mutated in the scene `update` - I wonder if that could be throwing it off? If that’s the possibly a problem (?), is there some way to force the scene update to sync with the physics update?

I also can confirm that setting `collisionBias` to any number seems to have no effect on collisions in any way that I’ve noticed.

---

<div class="post-metadata">

**Author:** ![samme](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/samme/32/5275_2.png) [@samme](https://phaser.discourse.group/u/samme)\
**Post date:** [February 3, 2021, 5:14pm UTC](https://phaser.discourse.group/t/sprites-falling-through-the-floor/8679/9 "2021-02-03T17:14:48Z")

</div>

Make sure you’re not modifying physics sprite positions (`sprite.x`, `sprite.y`) in scene `update()` or collision callbacks. You should modify only `body.x` and `body.y`, if needed.

---

<div class="post-metadata">

**Author:** ![t\_rev44](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/t_rev44/32/4157_2.png) [@t\_rev44](https://phaser.discourse.group/u/t_rev44)\
**Post date:** [November 20, 2021, 5:03am UTC](https://phaser.discourse.group/t/sprites-falling-through-the-floor/8679/10 "2021-11-20T05:03:59Z")

</div>

I never found a resolution to this issue, players still say the character falls through. I’ve read the thread multiple times, and it sounds like the solution is to make sure not to have fixedStep=false. However, when I remove that, the game becomes very choppy and stuttery, the player is constantly shifting all around when he should be standing still.

I can’t set it to true due to falling through the floor, and can’t set it to false due to stuttery movement. Can there even be a solution to a problem like this?

---

<div class="post-metadata">

**Author:** ![samme](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/samme/32/5275_2.png) [@samme](https://phaser.discourse.group/u/samme)\
**Post date:** [November 20, 2021, 4:55pm UTC](https://phaser.discourse.group/t/sprites-falling-through-the-floor/8679/11 "2021-11-20T16:55:25Z")

</div>

> [@t\_rev44](#):
>
> Sorry I should have clarified, it happens randomly when the player is airborne, either jumps or gets hit and is falling, then when they should land on the ground, they fall through it. They don’t fall through after standing or running.

It seems abnormal even for low FPS, unless the velocities are huge.

---

<div class="post-metadata">

**Author:** ![samme](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/samme/32/5275_2.png) [@samme](https://phaser.discourse.group/u/samme)\
**Post date:** [November 21, 2021, 4:57pm UTC](https://phaser.discourse.group/t/sprites-falling-through-the-floor/8679/12 "2021-11-21T16:57:35Z")

</div>

> [@t\_rev44](#):
>
> However, when I remove that, the game becomes very choppy and stuttery, the player is constantly shifting all around when he should be standing still.

I tried the game with `{ fixedStep: true, fps: 60 }` and I didn’t see any of that. It seemed to run normally. I also tried it with `{ fps: 5 }` and the character fell through the floor.

So you might try something like `{ fixedStep: true, fps: 300 }` to see if it removes the stuttering on your machine.

---

<div class="post-metadata">

**Author:** ![kittykatattack](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/kittykatattack/32/3888_2.png) [@kittykatattack](https://phaser.discourse.group/u/kittykatattack)\
**Post date:** [December 3, 2021, 12:09pm UTC](https://phaser.discourse.group/t/sprites-falling-through-the-floor/8679/13 "2021-12-03T12:09:34Z")

</div>

I just want to verify having had this same issue for more than a year, and having read and tried every suggested solution on the net, my sprites still fell through the floor maybe one out of 100 times on lower frame rates.  
Our team ended up writing a custom platforming engine which solves this - but it was a lot of work.

---

<div class="post-metadata">

**Author:** ![samme](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/samme/32/5275_2.png) [@samme](https://phaser.discourse.group/u/samme)\
**Post date:** [December 3, 2021, 6:35pm UTC](https://phaser.discourse.group/t/sprites-falling-through-the-floor/8679/14 "2021-12-03T18:35:32Z")

</div>

If have `fixedStep` turned off, there’s one more thing you can try — increase the `fps.min` value in the game config.

---

<div class="post-metadata">

**Author:** ![phoenix](https://avatars.discourse-cdn.com/v4/letter/p/0ea827/32.png) [@phoenix](https://phaser.discourse.group/u/phoenix)\
**Post date:** [March 19, 2022, 3:03pm UTC](https://phaser.discourse.group/t/sprites-falling-through-the-floor/8679/15 "2022-03-19T15:03:34Z")

</div>

I’ve been having similar issues and what worked for me, oddly enough was _decreasing_ the fps from 60 to 30. Can anyone explain that?
