I wrote a simple program where i can move around some objects. Every object has a bounding box and I use hooke's law to apply forces to the colliding objects. On every tick, I calculate the forces, divide them by the masses, multiply by elapsed time to get the velocities and then move the objects. However, this leads to perfect elastic collision.
Each of my bounding boxes has a priority value. Lower priority boxes can't push higher priority ones. This is important, because I want to have immovable objects later on. I want my spring formula to work like a rubber ball that you let go of above the ground. In other words, I want to be able to control how much of the momentum gets absorbed (it's supposed to turn into heat energy afaik) in the collision.
How should I go about this in a real-time simulation? (a before-after formula is no good, the collision happens in a time interval)