# How to check physics worldbounds?

**URL:** <https://phaser.discourse.group/t/how-to-check-physics-worldbounds/4758>\
**Category:** Phaser 3\
**Created:** [January 2, 2020, 9:11pm UTC](https://phaser.discourse.group/t/how-to-check-physics-worldbounds/4758 "2020-01-02T21:11:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![William\_Soeparjo](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/william_soeparjo/32/1406_2.png) [@William\_Soeparjo](https://phaser.discourse.group/u/William_Soeparjo)\
**Post date:** [January 2, 2020, 9:12pm UTC](https://phaser.discourse.group/t/how-to-check-physics-worldbounds/4758/1 "2020-01-02T21:12:00Z")

</div>

this.physics.world.setBounds(0, 0, config.width, config.height);  
this.physics.world.on(‘worldbounds’, onWorldBounds);

```
	let player = this.physics.add.image(200,100,'a');
	player.setDamping(true);
	player.setDrag(0.99);
	player.setMaxVelocity(100);
	player.setCollideWorldBounds(true);
	player.body.onWorldBounds = true;
	let enemys = this.physics.add.group();

function onWorldBounds (body, blockedUp, blockedDown, blockedLeft, blockedRight){
		if(blockedUp){ //If ball move out of screen
			//
			body.alpha = 0.5;
		}
		
		console.log('fff')
	}

```

onWorldBounds are called 20 times every second even player are not collision with bounds.  
If player collision with bounds, it’s not even detected.

How to fix this?

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:** [January 2, 2020, 10:12pm UTC](https://phaser.discourse.group/t/how-to-check-physics-worldbounds/4758/2 "2020-01-02T22:12:31Z")

</div>

Can you see the world bounds?

---

<div class="post-metadata">

**Author:** ![William\_Soeparjo](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/william_soeparjo/32/1406_2.png) [@William\_Soeparjo](https://phaser.discourse.group/u/William_Soeparjo)\
**Post date:** [January 3, 2020, 11:28am UTC](https://phaser.discourse.group/t/how-to-check-physics-worldbounds/4758/3 "2020-01-03T11:28:18Z")

</div>

What its mean?

Physics can’t move outside of screen, so i think worldbounds are working, but the collision with bounds are not detected

---

<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 3, 2020, 8:00pm UTC](https://phaser.discourse.group/t/how-to-check-physics-worldbounds/4758/4 "2020-01-03T20:00:15Z")

</div>

I don’t understand, sorry. 😕

Is `onWorldBounds()` being called or not? If it’s being called, which body is in the `body` argument?

---

<div class="post-metadata">

**Author:** ![William\_Soeparjo](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/william_soeparjo/32/1406_2.png) [@William\_Soeparjo](https://phaser.discourse.group/u/William_Soeparjo)\
**Post date:** [January 3, 2020, 10:57pm UTC](https://phaser.discourse.group/t/how-to-check-physics-worldbounds/4758/5 "2020-01-03T22:57:05Z")

</div>

No problem

I copied it from my old game, i think it was object that collision with bounds.

It’s fixed now, i don’t know how i fixed it, just working.

Thanks
