Cannon.js collision - preservation of energy

I’m using cannon.js to handle collisions 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.

Is it possible?

Consider to ask pure cannon.js related questions at the respective repository:

Nobody is going to answer in that website. The real problem is that Physijs and Cannonjs are not a maintained anymore. With the last releases of Threejs they give some errors and now I don’t know what to use as physics engine anymore. I have been using Threejs for few years and now it looks like there is no choice but migrate to another platform.

I made a physics library on top of ammo.js (just like physijs) which might help you. It’s enable3d.io.

1 Like

Thanks yannick, this could be useful. At the moment I’ve been using Physijs and I was trying to replace it with Cannonjs. I could try replacing it with your library instead. I’m gonna come back to you when I finished and let you know if it worked. Anyway, I must say that Threejs users’ should not rely on good heart people library’s but Threejs should provide with its own physics engine.

1 Like

This official cannon.js/three.js demo seems to work fine without issues:

https://threejs.org/examples/physics_cannon_instancing

Besides, there are multiple official example with ammo.js:

https://threejs.org/examples/?q=ammo

1 Like

Hi Mugen87, maybe I got the wrong Cannonjs’s repository, but it looks like the last commit was 5 years ago. Also, it’s a good thing when you have a forum like this one where you can ask questions and compare your experiences but not too many people are still using Physyjs and CannonJs and when you have some problems that you can’t figure out by your self, you get in trouble. (I don’t want to use another tool which is going to disappear like Physijs) I have never thought of using Ammojs and I’m going to evaluate also this one before to take a decision. Thanks

we picked up cannon, you can ask here https://github.com/react-spring/cannon-es it’s constantly being updated now. most pr’s that were left hanging are in there already, lots of bugfixes and some new features from us. i just help out a little, couldn’t answer your question but the others for sure can.

1 Like

2 Likes

It works perfectly!! thanks

1 Like