- Home /
Question was based on a flawed understanding of basic phycics.
How can I make mass influence the effects of a collision?
I have two objects, the player and a testcube, collide with each other. I want the player to be pushed farther away if I increase the mass of the cube. I thought that increased mass meant increased collision force on the collided object. Is this wrong?
Scenario: One unmoving player object and a standard cube. Both have attached a rigidbody and a cylindrical collider. Both are unaffected by gravity and are not kinematic. I have a script that sets the cube sliding towards the player with an initial velocity. The cube is destroyed on contact with the player, as for the purposes of the game most of the objects colliding with the player destroy themselves after contact. At collision, the player is pushed some distance away from the point of impact. The magnitude of this distance, however, is only affected by the speed of the cube at collision, not by its mass. Except for just a tiiiiiny, tiny increase in distance when I increase the cube's mass from 1 to 100. After that, further increase in mass yields no effect.
Is there something about the physics model I'm not getting? Is my understanding of physics at fault? Have I made an error somewhere that messes with the physics?
Thanks in advance
Edit: After consulting wikipedia and some basic math, I appear to have misunderstood collision physics. Under equal impact velocities, difference in mass between two objects can at maximum only amount to a factor 2 in launch velocity magnitude increase. Thank you for your answers.
Answer by Bunny83 · Sep 19, 2017 at 03:27 AM
Well, what physics material do those two colliders have? I guess you want a 100% elastic collision? In this case you have to use a material with a bounciness of "1" on both objects. With a bounciness of 0 you essentially get a 100% inelastic collision.
In both cases the actual impulse should be preserved. In an inelastic collision the two objects basically become one mass and the impulse energy will be distributed across the combined mass. If the object that is hit was at full rest the resulting velocity is always smaller than the velocity of the object colliding as the mass suddenly increased. Though an elastic collision could result in a higher velocity if the resting mass is smaller than the mass that hits the resting mass.
Answer by Cornelis-de-Jager · Sep 19, 2017 at 03:12 AM
This is because when they collide they transfer their momentum over. If you want to have an effect where they just bounce off without the transfer of momentum then you will want to have a look at Physics Marerials:
Answer by Nocternios · Sep 19, 2017 at 03:42 AM
I did experiment around a little with physics materials with different values for bounciness. This added bounciness increased the distance a little bit, but again did so largely independent of mass. When both objects have a physics material with bounciness=1, the player is only pushed ~0.4 meters farther away when I use a cube with a mass of 100 instead of a mass of 1.
0.4
meters in distance? Don't we talk about energy and velocity? Do you use drag on your object? $$anonymous$$aybe the drag is too much? Unity's drag factor is a very (very) rough approximation of air resistance / drag in general. The implementation is also rather strange.
I would also recommend that you don't destroy the object right on collision if you want to preserve the impulse. $$anonymous$$aybe the collision hasn't been resolved completely. Try adding a small delay to your Destroy call. Destroy can take a second parameter which takes a delay time in seconds:
Destroy(gameObject, 0.1f);
Follow this Question
Related Questions
Rigidbodies won't collide if mass difference is too high 0 Answers
How may I observe expected physical interactions while using Rigidbody.MoveRotation()? 1 Answer
Collision interpenetration and object getting stuck 1 Answer
Non-convex MeshCollider with non-kinematic Rigidbody? 2 Answers
How do I "remove/disable" collision? 3 Answers