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