Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
fatbatman opened this issue Jul 6, 2023 · 13 comments
Open

Comments

@fatbatman
Copy link

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
Copy link
Author

Are there any work arounds for this?

@lo-th
Copy link
Owner

lo-th commented Aug 20, 2023

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

@brandon-lb
Copy link

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-lb
Copy link

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-lb
Copy link

brandon-lb commented Sep 6, 2023

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

@fatbatman
Copy link
Author

fatbatman commented Sep 20, 2023

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

@lo-th
Copy link
Owner

lo-th commented Sep 22, 2023

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

@fatbatman
Copy link
Author

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
Copy link
Author

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.

@lo-th
Copy link
Owner

lo-th commented Oct 5, 2023

mm ok i can increase contact

@fatbatman
Copy link
Author

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.

@lo-th
Copy link
Owner

lo-th commented Oct 5, 2023

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

@fatbatman
Copy link
Author

fatbatman commented Nov 8, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants