This is a general question on how to approach physics with constant energy.
I have an object with a box body surrounded with wall objects like in the tutorials.
The main object and walls have Restitution for bounce and no friction.
I give the main object an initial speed, but because energy is lost over time due to rebounding off the walls, the object eventually slows down.
To have an object that never loses energy, is the general approach to constantly give an impulse to the object or is there a config item I am missing that I can use that will stop any energy being lost?
Comments
I'm afraid that you can't keep a constant energy by relying on the physics simulation. The two major reasons for that being that the physics solver, being iterative and using single precision floats, can only result in approximations.
If you want to maintain energy (ie. velocity with constant mass), I'd enforce the speed manually and would bypass any use of impulse whatsoever.
Out of curiosity if it for N.E.X.U.S. Reloaded or another project?
Yes, this is a new project, not N.E.X.U.S.
It cropped up in my head one day and it started out as just a few physics experiments. But then I started some serious progress on it
It's a much simpler concept and I should be able to bring it to completion fairly quickly.
Then it'll be back to N.E.X.U.S.