I try to make an elastic collision between two cubes, but the collision reaction is inelastic - when one cube collide the other, they both continue moved together attached.
The snapshot shows the scene where both cubes have the same properties and has the same physical material:
Mass: 1kg
Gravity: False
Friction: 0
Restitution: 1 ← this is set to 1 in order to create the “bouncing” reaction when collide
Cube 1 then get an impulse of 1Ns in x direction which make it move at velocity of 100cm/s toward cube 2. When it hits Cube 2, they both continue together with a velocity of 50cm/s
Changing Restitution between 0 and 1 doesn’t have an effect , the collision is always inelastic. How should I make the physics collision reaction elastic ?
You need lower mass.
The physics system doesn’t handle them very well, and impact response is dampened by them far more than should be.
Try overriding the mass of the cubes and dropping them significantly to see if you don’t get the response you’re looking for.
This is why physics materials allow you to adjust the density (weight ratio) of materials to determine the mass of objects.
I followed your suggestions. Changing density value does nothing (I don’t know what it does if so). I also tried lowering the cubes mass to 0.01Kg (The parameter MassInKg) and the Impulse to cube 1 was reduced accordingly to 1Ns for keeping the velocity to 100cm/s. The results are the same, totally inelastic collision.
I’ve got the solution from Marco Ghislanzoni (https://www.youtube.com/c/MarcoGhislanzoni)
There is UE4 parameter called Bounce Threshold Velocity which indicates to physx what is the minimum velocity of the object to allow bouncing calculation.
The default is 200cm/s. In my test the object velocity is 100cm/s, so no bouncing happens.
After changing this parameter to 10m/s, I’ve got bouncing according to Restitution value.
Additional note:
The bouncing results may not always be elastic perfect - this may happens due to the physx solver numerical errors. This can be fixed by adding sub steps.