Phaser P2 physics gravity should be pulling straight down, but is pushing horizontally as well?

179
January 15, 2018, at 4:27 PM

I have been trying to establish a basic world with Phaser and the P2 physics system. However, following the basic tutorials and examples, my sprite gets pulled to the right as if there is horizontal gravity force applying to it. I have tried several things, including explicitly setting gravity.x to zero, but nothing seems to have fixed the issue.

The sprite itself's anchor is set to 0.5 and 1, in order to center it on horizontal. Here is a short clip of what's happening:

https://i.gyazo.com/9bbcf69b6c7fb1e8a65fe3b4b1f676f6.mp4

The code I've included so far for the system is this:

game.physics.startSystem(Phaser.Physics.P2JS);
game.stage.disableVisibilityChange = true;
game.physics.p2.gravity.y = 80;
game.physics.p2.applyGravity = true;    

^ Physics settings

Phaser.Sprite.call(this, game, X, Y, 'ball');
game.physics.p2.enable(this);
this.body.damping = 0.5;
this.body.fixedRotation = true;
this.anchor.x = 0.5;
this.anchor.y = 1;

^ Sprite settings

There are no other forces beyond default acting on the rigidbody. What is going on here?

READ ALSO
Javascript logical operation (a === true || a === false)

Javascript logical operation (a === true || a === false)

I found this piece of code inside momentjs

181
Have a Google Form set the title to the users email

Have a Google Form set the title to the users email

I'd like to make a Google Form that I can email to multiple people and when they open the form to fill it out, the title will be replaced with their email

160