Hey guys, i'm currently doing a internship for my studies. My task is to evaluate whether it is suitable to use Unity for physical simulations, especially regarding it's accuracy. For this, I have created an easy scene with a halfpipe and a sphere rolling on it. There is no own code attached to both of them. For testing purpose, I have attached PhysicsMaterial with both static and dynamic friction and bounciness set to zero to the halfpipe and the sphere. Drag and angular drag are also set to zero. In my understanding, this process should be simulated without any loss of energy. But when I hit play, the sphere does loose energy. And since the movement slows down quite fast, it seem's to be a quite huge loss. Has anyone of you ever tested something like this and experienced thes phenomenon, too? I'm curious if someone has an idea what causes this loss of energy. For me, it seem's to be a problem of PhysX. If so, is there another physic-engine that does conserve energy? Or an engine, that is already used especially for engineering simulation purposes? This is what it currently looks like.
Unity is not designed to simulate real time physics. While it can get accurate enough for gaming purpose, it is not suitable for scientific calculations. Game engines uses tons of simplifications for performance reasons. Smoke and mirrors. For such, matlab and relevant tools are more adequate. Running calculations first, then replaying in real time. Saying all that, using DOTS may give some benefits on the subject, but it is completely separate can of worms.
If I were to use Unity for anything like this I would use it purely for visual presentation only and keep my own simulation of what ever is relevant. This is more to do with physx from nvidia then unity (they actually only do the visuals, hehe). Maybe it will be different with the upcoming havok.. but not likely imho. did you try fiddling around the physics settings, rigidbody setting? (besided the friction and drag you mentioned) like the 'enhanced determenisim(?)', lowering fixed time and all that jazz?
I have tried these settings. I also tried it with more solver iterations and the two-directional friction type. Nothing solved this energy-loss problem. It seems like this is really just a problem of PhysX.
Does someone have any experience with the Bullet physic engine? I have read, that this engine is a bit more physical in it's calculations. Is this correct?
If you want best performance of bullet physics, you need use it outside Unity. Unity cripples its capabilities. That means, writing your app in separate environment. Either way, you will not get realistic behavior in real time in any game engine. These are not for simulations tools. You probably want as well for such things double precision. Alternatively, use DOTS with own double precision physics. Then run simulation. After simulation is done, run approximation, to render. Still, probably it wont be real time, depending on complexity. But question is, why you so focusing on game engine for such application in first place?
It is true that Physx does a lot simplification but it should obey the Conservation of Energy, more or less. At least in this very simple scenario Could you please attach the halfpipe? I would like to test it myself
I did a bit more testing and changed the FixedTimestep to about 1 ms. This seems to conserve the energy much better. I would upload the halfpipe, but i receive an error message, that I can't upload .fbx-Files. The halfpipe was created in Blender.
I have tested a free falling ball of 1e3 of mass from 1000 meters high. It seems to conserve the energy