[ODE] Easy Newbie Question
DjArcas
djarcas at hotmail.com
Thu Jan 29 09:06:15 MST 2004
----- Original Message -----
From: <coberr at scottsdaleins.com>
To: <ode at q12.org>
Sent: Wednesday, January 28, 2004 2:38 PM
Subject: [ODE] Easy Newbie Question
>
> I have just started using ODE a little bit ago - and I think it is
> fantastic!
>
> However, I have a simple question:
>
> In my application, I want to play a sound when two objects collide. In
> this case, there are shapes bouncing on a plane.
>
> Initially, I have tried to play a sound everytime there is a collision.
> Specifically, I play a sound if dCollide() returns any contact points at
> all. dCollide() is called from a callback registered with
dSpaceCollide().
>
> The problem is that the sound is being played much too frequently -
> obviously many contact points are created within any given small
timeframe.
>
> The solution I am considering is to only play a sound if there is a
> collision AND a certain amount of time has elapsed.
>
> My question is whether this is the best approach.
>
Well, that's how I did it on Gumball Rally, Rally Fusion, MotoGP,
Burnout2... :-)
The only thing you want to add to that is AND CollisionImpulse < minimum
collision impulse.
A slightly more elegant system is to say 'if there is a collision and a
certain amount of time has elapsed and it's above the threshhold OR there is
a collision and it's impulse is above the threshold AND it's more than a
certain amount above the last time AND the time hasn't elapsed yet' - that
stops you missing out a huge impact just because there was a tiny one a
fraction of a second earlier.
More information about the ODE
mailing list