Get Velocity of Rigidbody "when collision occurs"

Hi guys,
I’m currently experimenting things with 2D physics and a simple bouncing ball.

I’d like to play different sounds or different volumes depending on “how hard” the ball hits the walls.I guess I could implement something on my own but I cannot think there is nothing “out of box” I could use.

After all, when 2 rigid bodies collide, they bounce depending on the kinetic force and masses.
So how can I access this “kinetic” value on trigger ? My guess is at the exact moment the object collides with wall the velocity is null, right ?

As u can see, I’m kinda confuse here so any advice would be appreciated ! :slight_smile:

So, for those who could be interested, here is a first “solution” :
I just check the velocity.magnitude (divided by an arbitrary constant) on trigger enter, the trigger collider (on a child object of ground) is a little bit bigger than the ground so we check the speed right before it actually hits it.

The volume of the audio source responsable for playing the bouncing sound is then multiplied by this “magnitude/constant value”

It works pretty well, but if the ball falls really vertically right beside a “block” it can trigger a bounce.I guess I could check the direction of the velocity vector and compare it with the orientation of the ground block but I don’t know if this is really clever for a mobile game :confused:

Thread Closed.