How to check physics worldbounds?

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

Can you see the world bounds?

What its mean?

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

I don’t understand, sorry. :confused:

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

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