You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using 2.7.5.
When a physics body is moving fast enough, it can pass though other bodies that it is supposed to collide with. The velocity that this happens at is not the same for rectangle and circle bodies.
Here it can be seen, from Phaser sandbox. Press space to jump. The rectangle and circle bodies fall and hit the platform below at the same speed, but the circle passes though. When tried with lower values for gravity, this doesn't happen.
/** * Generated from the Phaser Sandbox * * //phaser.io/sandbox/rDpRbHcW * * This source requires Phaser 2.6.2 */vargame=newPhaser.Game(800,600,Phaser.AUTO,'',{preload: preload,create: create,update: update,render: render});functionpreload(){game.stage.backgroundColor='#85b5e1';game.load.baseURL='http://examples.phaser.io/assets/';game.load.crossOrigin='anonymous';game.load.image('player','sprites/phaser-dude.png');game.load.image('platform','sprites/platform.png');}varplayer;varplayer2;varplatforms;varcursors;varjumpButton;functioncreate(){player=game.add.sprite(100,200,'player');player2=game.add.sprite(150,200,'player');game.physics.arcade.enable(player);game.physics.arcade.enable(player2);player.body.collideWorldBounds=true;player.body.gravity.y=200;player2.body.setCircle(20);player2.body.collideWorldBounds=true;player2.body.gravity.y=200;platforms=game.add.physicsGroup();platforms.create(500,150,'platform');platforms.create(-200,300,'platform');platforms.create(400,450,'platform');platforms.setAll('body.immovable',true);cursors=game.input.keyboard.createCursorKeys();jumpButton=game.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR);}varcollideSpeed=0;varcollideSpeed2=0;functionupdate(){game.physics.arcade.collide(player,platforms,function(){collideSpeed=player.body.velocity.y;});game.physics.arcade.collide(player2,platforms,function(){collideSpeed2=player2.body.velocity.y;});player.body.velocity.x=0;player2.body.velocity.x=0;if(cursors.left.isDown){player.body.velocity.x=-250;player2.body.velocity.x=-250;}elseif(cursors.right.isDown){player.body.velocity.x=250;player2.body.velocity.x=250;}if(jumpButton.isDown&&(player.body.onFloor()||player.body.touching.down)){player.body.velocity.y=-400;}if(jumpButton.isDown&&(player2.body.onFloor()||player2.body.touching.down)){player2.body.velocity.y=-400;}}functionrender(){game.debug.text('rect Y velocity: '+player.body.velocity.y,8,140,"#ff00ff");game.debug.text('rect X velocity: '+player.body.velocity.x,8,160,"#ff00ff");game.debug.text('rect collide speed: '+collideSpeed,8,180,"#ff00ff");game.debug.body(player);game.debug.text('circ Y velocity: '+player2.body.velocity.y,408,140,"#ff00ff");game.debug.text('circ X velocity: '+player2.body.velocity.x,408,160,"#ff00ff");game.debug.text('circ collide speed: '+collideSpeed2,408,180,"#ff00ff");game.debug.body(player2);}
The text was updated successfully, but these errors were encountered:
This Issue is about
I'm using 2.7.5.
When a physics body is moving fast enough, it can pass though other bodies that it is supposed to collide with. The velocity that this happens at is not the same for rectangle and circle bodies.
Here it can be seen, from Phaser sandbox. Press space to jump. The rectangle and circle bodies fall and hit the platform below at the same speed, but the circle passes though. When tried with lower values for gravity, this doesn't happen.
The text was updated successfully, but these errors were encountered: