phaser
phaser copied to clipboard
Mousespring causes an error when clicking off scene
Version
- Phaser Version: 3.70.0 and 3.60.0
- Operating system: Windows 10
- Browser: Google Chrome 119.0.6045.160
Description
When I use Mousespring with Matter and click somewhere outside the scene (move the camera off scene), the following error occurs:
"Uncaught TypeError: Cannot read properties of undefined (reading 'getWorldPoint')"
When I try this on safe phaser examples, I encounter the same error.
Example Test Code
class Example extends Phaser.Scene
{
create ()
{
this.matter.add.mouseSpring();
this.matter.world.setBounds(0, 0, 800, 600, 32, true, true, false, true);
this.tweens.add({
targets: this.cameras.main,
y: 500,
ease: "Sine.easeInOut",
repeat: 0,
duration: 500
});
}
}
const config = {
type: Phaser.AUTO,
width: 800,
height: 600,
backgroundColor: '#c4dedf',
parent: 'phaser-example',
physics: {
default: 'matter',
matter: {
debug: false,
enableSleeping: true
}
},
scene: Example
};
const game = new Phaser.Game(config);