Problems with ::OnStartTouch ::OnEndTouch ::OnTouch

Petri

30-10-2007 07:19:24

Hi,

What would be best way to synchronize 3d sound playing with collision callback?

For example playing sound when ball hits a goal post or ball hits to the ground.

For me, it seems that sometimes it's best to put sound playing to OnEndTouch and sometimes to OnTouch.

Is there any way to handle all situations same way?

Why NxOgre doesn't give contact normal for users like ODE does to deal this issue?

Toby

30-10-2007 08:34:56

Hi,

You setCollisionCallback flag to NX_NOTIFY_ALL. Then you can also choose to keep only on_start_touch for instance by NX_NOTIFY_ON_START_TOUCH.

Petri

30-10-2007 08:58:39

I know. But that doesn't actually solve my problem.

Could there be some problems with CCD with sphere? Does it somehow interfere this collision detection because it seems that not all collisions are detected correctly?

luis

30-10-2007 09:12:28

For me, it seems that sometimes it's best to put sound playing to OnEndTouch and sometimes to OnTouch.
I'm using OnStartTouch to trigger sound effects and it is working OK, what is the problem you have ? cant you hear the effect ?

The only thing I had to do is test if the effect is already playing because the OnStartTouch callback will be called two times per hit, one for actor A and another one for B.....

Why NxOgre doesn't give contact normal for users like ODE does to deal this issue?
I dont know if it is possible but i would like to have all the contact information too....

betajaen

30-10-2007 09:20:23

Why NxOgre doesn't give contact normal for users like ODE does to deal this issue?
I dont know if it is possible but i would like to have all the contact information too....


The NxContactPair class only gives out the two actors, sumNormalForce and sumFrictionForce.

I haven't implemented the last two, but if anyone really needs them, I can put it in.

Petri

30-10-2007 09:41:22

Yeah, it would be very nice to get that force information.

I was using ode before and I handled this issue by calculating

vector3 result = pBody2->GetLinearVelocity() - pBody1()->GetLinearVelocity();

float value = fabsf(result.dotproduct(contactNormal));
if(value > 1.0f)
{
PlaySound here
}

This calculation checks that if colliding objects directions are opposite we can play sound or something like that.

So i would like to use this also with NxOgre if it is possible.

betajaen

30-10-2007 10:12:54

I'll add it to the TODO list.

But if anyone wants a stab at it before I do, you start it in SceneContactController.

Petri

30-10-2007 10:20:32

Thanks very much betajaen.