hvj Posted April 17, 2014 Share Posted April 17, 2014 Hello Is there anything like bounce in Arcade Physics.... in P2 Physics? I can simply bounce two objects on collision in Aracde, but I cannot generate something like that in P2!I've defined collisions, bodies.... but I cannot generate what I want. I can change velocity to simulate bouncing, but I cannot find collide direction to simulate it correctly! In my sample, I don't want to have any gravity and friction. Thanks a lot. Link to comment Share on other sites More sharing options...
rich Posted April 17, 2014 Share Posted April 17, 2014 It's called restitution. Look at the Contact Materials example. hvj 1 Link to comment Share on other sites More sharing options...
george Posted April 17, 2014 Share Posted April 17, 2014 The magic word you're searching for is restitution. This is a property you can set on a contact equation during a collision. To make this easy, phaser and p2 defines materials which defines the behaviour of collisions between to objects. For bounciness restitution needs to be greater than 0. 0 is no bounce at all. P2's example from schteppehttp://schteppe.github.io/p2.js/demos/restitution.html Phaser also has an example of contact materialshttp://examples.phaser.io/_site/view_full.html?d=p2%20physics&f=contact+material.js&t=contact%20material Have fun! hvj and jerome 2 Link to comment Share on other sites More sharing options...
Recommended Posts