-
Notifications
You must be signed in to change notification settings - Fork 28
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
Simulation Event Callback #7
Comments
Ahh... I think it's to do with I'll comment with my findings |
You are right, I did not include those flags by default because invoking JS / Java callbacks from native code is rather expensive and the touch notification function can be called an awful lot of times per simulation step (depending on the scene). So enabling them, without actually needing them wastes a lot of performance. However, the pairFlags |= physx::PxPairFlags(physx::PxU16(filterData0.word2 | filterData1.word2)); meaning that you can pass additional custom flags in by setting them in So you should be able to set the |
Thank you for explaining :) |
@fabmax I'm trying to pull both shapes & actors out of an Code: eventCallback .onContact = (pairHeader: PhysX.PxContactPairHeader, pairs: PhysX.PxContactPair, nbPairs: number) => {
for (let index = 0; index < nbPairs; index++) {
const pair = PhysX.TypeHelpers.getContactPairAt(pairs, index);
console.log('Contact begin');
console.log(pair.shapes);
console.log(pairHeader);
}
}; Output:
|
Hmm, I would say you are doing it right. It's a bit odd that pairHeader is only a number. In native code it's passed in by reference and the WebIDL definition also looks right. So it should be an object... You can try what happens if you put that number into some The |
well getPxContactPairHeaderAt return actors is a array so
my question is how find original PxRigidDynamic from this pxActor ? |
ok i find
now i have good ptr so i can find good name |
@lo-th I've posted a little snippet of code that will 'fix' Enums in JS This should allow you to do
|
i have problem on contact work but actor2 not good ?
|
There is another function you have to use here:
I know the API is not self-explanatory here. The problem here is that getActorAt expects an array of values, while the actors field is an array of pointers. |
yes that work ! |
Hi, I am trying get both actors from contact pair header. I'm doing: eventCallback.onContact = (pairHeader, pairs, nbPairs) => {
var head = PhysX.NativeArrayHelpers.prototype.getContactPairHeaderAt(pairHeader);
var a0 = PhysX.NativeArrayHelpers.prototype.getActorAt(head.actors, 0);
var a1 = PhysX.NativeArrayHelpers.prototype.getActorAt(head.actors, 1); Just like @lo-th did and I can get the first actor but the second actor is invalid. I tried to use PhysX.SupportFunctions.prototype.PxContactPairHeader_getActor(head, 1) as you mentioned in your last comment but that binding does not seem to exist. It would be great if you can give me a guide/hint on the issue. I'm very new to using physics engines and wasm codes. Thanks, |
I just tried: var a0 = head.get_actors(0);
var a1 = head.get_actors(1); and it seems to return valid Actors. Hope this is the correct way to retrieve them. |
Ah yes I removed that because there is now the |
hi i need get contact point info do you have methode ? note: i activate the good flag to report point |
maybe like that and in onContact loop
|
yes I think that is how I do it |
I'm having an issue where my
simulationEventCallback
/JavaSimulationEventCallback
doesn't seem to be called on collisions...Setup:
The text was updated successfully, but these errors were encountered: