Softer collisions?

G’day!

I’e been running into this a bit lately so I thought I’d post it up here. Just wondering is it possible to add a bit of softness or damping to a collision? Imagine a soft fluffy object running into something solid, that kind of thing.

I was thinking about it today with a rigidbody character controller to stop any small collision from sending it crazy but I could think of a lot of other uses.

Any ideas?

Thanks,
Pete

Maybe lower the max de-penetration velocity, and or change it every update depending on the speed of the rigidbody?

Or find a softbody asset :stuck_out_tongue:

Thanks, I just gave that a try though and didn’t get anything out of it (which is a shame because it sounds like it could help).
I tried setting a value of 0.1,1,10 and 100. Check out the results :smile:

I made the change just before firing the rigidbody objects, maybe that’s not the right way to do it? -

    public void FireBall(){
        rigidbody.maxDepenetrationVelocity = maxD;
        rigidbody.AddForce(new Vector3 (-20,0,0),ForceMode.VelocityChange);
    }

Anyway, jumping on asset store now :slight_smile:
P.

Because under those conditions, it never really penetrates much :slight_smile: You can’t use hacks like that for this purpose.

If you want fluffy then you’re going to need to use raycasts or spherecasts…

Yeah bummer,
The docs made it sound like it might be appropriate -

Just had a quick scan of the asset store and there really doesn’t seem to me anything for this kind of thing. I guess I could use a spherecast ray or something?
P.

I assume you’ve already tried the Bounciness parameter in the physic material, right?

Hey Edy, Yeah I know of that, I was just checking to see if i’d missed something softer, kinda like if the object was a water balloon or something like that. But that kind of stuff is pretty expensive as far as i know.
In the past I’ve used triggers instead of colliders for a lot of objects and just measured how close the player was to give a softer collision. Just thought there might have been a better way.

I’m encountering similar issues with vehicles. Sometimes after a crash at high speeds the vehicle starts rolling (ok) but after some single impact the vehicle suddenly gets projected upwards at high speed. This happens even on flat ground and with max de-penetration velocity configured.

So I’m thinking on imposing some kind of velocity constraint: If a large velocity change in the vertical direction is detected, then clamp the velocity. Something like this pseudocode:

if (Abs(prevVelocity.y - rigidbody.velocity.y) > threshold)
    rigidbody.velocity.y = Clamp(rigidbody.velocity.Y, -maxvelocityY, +maxVelocityY)

Or I may measure the specific velocity change that exceeded the threshold (it happens within a single frame) and allow only a fraction of it, instead of clamping velocity to a global limit. There are several possible paths. It’s just a conjeture though, I still have to test this solution properly.