# Object Pushed through Floor

**URL:** <https://phaser.discourse.group/t/object-pushed-through-floor/10609>\
**Category:** Phaser 3\
**Created:** [November 6, 2021, 9:02pm UTC](https://phaser.discourse.group/t/object-pushed-through-floor/10609 "2021-11-06T21:02:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![paynterc](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/paynterc/32/4430_2.png) [@paynterc](https://phaser.discourse.group/u/paynterc)\
**Post date:** [November 6, 2021, 9:02pm UTC](https://phaser.discourse.group/t/object-pushed-through-floor/10609/1 "2021-11-06T21:02:43Z")

</div>

I’ve never been able to get this to work as expected. I have a static group for the floor, and one or more physics objects as player, enemies, whatever.

When one physics body lands on another, it pushes the other one through the floor. I’ve tried setting pushable to false and even cancelling out the incoming velocity, but nothing works. What is the best way to prevent this?

[https://jsfiddle.net/paynterc/gsw48zqk/8/](https://jsfiddle.net/paynterc/gsw48zqk/8/)

```javascript
var config = {
    type: Phaser.AUTO,
    width: 800,
    height: 800,
    parent: 'test',
    scene: {
        preload: preload,
        create: create,
        update: update
    },
    physics: {
      default: 'arcade',
      arcade: {
        gravity: { y: 2600 },
        debug: false
      }
  	},
};

var game = new Phaser.Game(config);

var obj1, obj2,platforms;

function preload ()
{
this.load.image('dude', 'https://i.postimg.cc/tCMhjzhF/Snowman.png');
this.load.image('block', 'https://i.postimg.cc/TPcRgfJG/Block.png');
this.load.image('snowball', 'https://i.postimg.cc/rm1zCjBR/snowball.png');
}

function create ()
{

  
  platforms = this.physics.add.staticGroup();
  platforms.create(400, 400, 'block');
  
 obj1 = this.physics.add.sprite(400, 20, 'dude');
  obj1.body.pushable=false;
  obj1.setBounce(0.2);
  
  obj2 = this.physics.add.sprite(400, 350, 'snowball');
  obj2.body.pushable=false;
  obj2.setBounce(0.2);
  

  this.physics.add.collider(obj1, platforms);
  this.physics.add.collider(obj2, platforms);
  this.physics.add.collider(obj1, obj2);

}

function update ()
{
	if(obj2.y>500){
  	obj2.body.velocity.y=0;
  	obj2.y=20;
  }
  if(obj1.y>500){
  	obj1.body.velocity.y=0;
  	obj1.y=20;
  }
  
}

```

---

<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 7, 2021, 3:18am UTC](https://phaser.discourse.group/t/object-pushed-through-floor/10609/2 "2021-11-07T03:18:01Z")

</div>

[Increasing physics FPS](https://jsfiddle.net/a2mwo5z1/1/) can help, if `pushable = false` doesn’t.

---

<div class="post-metadata">

**Author:** ![paynterc](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/paynterc/32/4430_2.png) [@paynterc](https://phaser.discourse.group/u/paynterc)\
**Post date:** [November 7, 2021, 9:43pm UTC](https://phaser.discourse.group/t/object-pushed-through-floor/10609/3 "2021-11-07T21:43:05Z")

</div>

An fps of 220 was enough to fix it. Thanks!
