Cannon.js collision - preservation of energy
cosentino-smeup opened this issue · comments
Hello, I’m using cannon.js to handle collisions in threejs and it’s working fine except for one case: I need the collision between a sphere and a box doesn’t make them lose energy so they can preserve their velocity. The box body is STATIC.
Is it possible?
As you can see in the following demo after the collision, the sphere lose energy and start going slower.
This is the build folder:
build.zip
Thanks,
Regards
You should be able to make a contact material between the two bodies and set restitution to 1 so no energy is lost on bouncing
here is a zip file containing the example. Uses cdns (three.js)/base repo code (cannon.js, orbitcontrols) so no need to download new libraries.
cannonjs-walls-collision.zip