Jump to content

Infinite Bouncing with P2 Physics?


Recommended Posts

Hey, new to Phaser here! I've been messing around with it, and I've been trying specifically to make a game where blocks bounce around a screen, starting at a random velocity, and continuing to bounce forever and ever with no friction, angular damping, or damping in general. Is there a way to do this easily in P2 physics? Or, rather, is there a way to make objects spin on hit like P2 physics offers in Arcade physics? I've tried adding

    block.body.damping = 0;
    block.body.friction = 0;
    block.body.angularDamping = 0;

into a forEach in my create function that goes over each block, and also added in

  game.physics.p2.restitution = 1;
  game.physics.p2.applyDamping = false; 
  game.physics.p2.applyGravity = false;

at the beginning of the create function, after starting the physics, but it seems like they still slow down over time. Am I doing something wrong, or is there another way to do this that's easier?

Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...