[ODE] Easy Newbie Question

coberr at scottsdaleins.com coberr at scottsdaleins.com
Thu Jan 29 09:38:18 MST 2004


Thank you for your response -

It helped me alot, but now I have one more question:

How do I calculate the CollisionImpulse?  I can see how to get the velocity
and mass of both bodies, and the position,normal, and depth of the contact
points.

I assume the CollisionImpulse is related to these quantities, but I am
still at a loss ....


Thanks again for any help or guidance, I really appreciate it
Bob





                                                                                                              
                          "DjArcas"                                                                           
                          <djarcas at hotmail.com>    To:   <ode at q12.org>; <coberr at scottsdaleins.com>            
                                                   cc:                                                        
                                                   bcc:                                                       
                                                   Subject:                                          Re:      
                                                   [ODE] Easy Newbie Question                                 
                          01/29/2004 10:06 AM                                                                 
                                                                                                              
                                                                                                              





----- 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