Jump to content

Infinite Bouncing with P2 Physics?


Betropper
 Share

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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