- Home /
Rigidbodies get huge amount of velocity when clipping into other Rigidbodies
Hey,
i'm currently stuck at a physics related issue, wondering why it happens and how to solve it.
In my game you're able to drive a heavy construction vehicle. At some places there are dynamic objects you can collide with, like a stack of europalletes. When you drive into these the physics work reasonably fine except when they're not. Mostly eveverything just slowly gets pushed outwards but sometimes when there is no way to go for a certain pallete it suddenly gets pushed away insaaaanely fast. It can end up flying away 5 to 10 meters, sometimes it even shoots way into the sky like a rocket.
I thought about clamping the velocity or adding a force in the opposite direction.
if (_rb.velocity.magnitude > 5f)
{
_rb.velocity = _rb.velocity.normalized * 5f;
}
This was my quick and dirty way of simply limiting the speed for testing purposes but even with that being checked every update the "shooting away" physics can happen. Maybe not as drastically because it quickly realizes that the object is too fast and clamps it's velocity, but i've still seen palletes "teleporting" 10 meters before they get slowed down.
Tried to search for answers online but so far I've come up empty. Any ideas why this is happening in the first place? Kind of feels like a physics engine bug to be fair.
Thanks in advance, have a nice week!
Kawa
have you tried different general physics settings? also do you have continuous dynamic checked on said rigidbodys?
Answer by Bunny83 · Apr 22, 2020 at 08:17 PM
Well, first of all how do you move your construction vehicle? Do you properly move it through physics? How many objects are involved when those "glitches" happens? Stacking several objects and pushing with great force onto such a stack you can get huge forces bouncing between the objects. You may want to increase the drag of your objects. However such extreme spikes most likely can't be avoided.
What is your mass ratio between your different objects? Unity / physX recommends to not go over 1000 but it's better to stay around a ratio of 100. Note that in the real world such reactions do actually exist. However most objects in the real world are not rigidbodies. Europalettes which are mainly made out of wood would simply bend or break if the forces gets too high. Also their "mass to cv" ratio is relativels low so if you accelerate such a palette in the real world it quickly slows down.
Unfortunately we don't have softbody physics nor realistic drag / air friction. You could implement your own more realistic drag.
Your answer
Follow this Question
Related Questions
How do I connect multiple spheres using joints and make a character? 1 Answer
Shooting a cannonball. 6 Answers
Solar System Simulator Orbits Not Working 2 Answers
My object falls through terrain. 8 Answers
How may I observe expected physical interactions while using Rigidbody.MoveRotation()? 1 Answer