phy icon indicating copy to clipboard operation
phy copied to clipboard

phy.add contact callback is called for all contacts when using Havok

Open fatbatman opened this issue 2 years ago • 13 comments

phy.add({ type:'contact', b1:obj1.name, b2:'obj2.name, callback: someCallback })

In Havok someCallback is called for all collisions involving obj1, not just those involving obj2 but arg.hit is always false.

Phsyx works as expected

Rapier, seems to always have arg.hit == true

Also, including all details of the contact in the collision callback argument is probably needed in most real world uses - body1, body2, position, velocity etc

fatbatman avatar Jul 06 '23 15:07 fatbatman

Are there any work arounds for this?

fatbatman avatar Aug 19 '23 19:08 fatbatman

yep i will make demo about that and standardize the process for all engine

lo-th avatar Aug 20 '23 08:08 lo-th

Actually, for me Havok worker "Character" example never calls any trigger. You can verify this by adding console logs to showContact and triggerContact and switching between PhysX and Havok.

brandon-xyzw avatar Sep 06 '23 18:09 brandon-xyzw

By the way, I actually want to get a list of all items that are colliding with a given mesh. Any idea the best way to do that?

brandon-xyzw avatar Sep 06 '23 18:09 brandon-xyzw

Sorry to pile on, but I also noticed both the point and normal arrays on a hit are always [0,0,0] as well.

brandon-xyzw avatar Sep 06 '23 20:09 brandon-xyzw

What's the recommended way to access the underlying physics engine so I can register a contact listeners directly as a workaround for now?

fatbatman avatar Sep 20 '23 14:09 fatbatman

contact is add to havok trigger is not constant ? i search why collision return need more research but is in good way

lo-th avatar Sep 22 '23 09:09 lo-th

It work better In the latest version with Havok - arg.hit is set correctly

I noticed b1, b2 must be in a specific order though

phy.add({ type:'contact', b1:'box1', b2:'sensor1', callback: trigContact}) //is called and arg.hit is set correctly phy.add({ type:'contact', b1:'box2', b2:'sensor1', callback: trigContact}) //is called and arg.hit is set correctly

//This behaves differently: phy.add({ type:'contact', b1:'sensor1', b2:'box1', callback: trigContact}) //is called and arg.hit is set correctly phy.add({ type:'contact', b1:'sensor1', b2:'box2', callback: trigContact}) //# IS NEVER CALLED #

contact point and normal information still isn't present.

Some way of register for all contacts of a given object using a wildcard would be useful.

fatbatman avatar Sep 28 '23 10:09 fatbatman

Using Havok contact events don't get triggered after registering more than about ~146.
This in a scene with about 160 rigid bodies in total.

fatbatman avatar Oct 04 '23 13:10 fatbatman

mm ok i can increase contact

lo-th avatar Oct 05 '23 07:10 lo-th

Is it possible to have wildcard for all contacts from an objects? as currently I have to register an object, e.g. a bullet, against all possible targets.
Also an ability to remove the contact.

fatbatman avatar Oct 05 '23 07:10 fatbatman

problem is with worker i have to limite message and return array i will think about that

lo-th avatar Oct 05 '23 07:10 lo-th

I see you increased the number of contacts that can be supported.
This means it lasts longer, but then runs out as old ones never get cleaned up. However, I can remove the contacts based on their name, but it means I need to store a mapping of those contact pairs relevant to each body.

fatbatman avatar Nov 08 '23 11:11 fatbatman