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

Contract listener questions #132

Closed
jankrassnigg opened this issue Apr 13, 2022 · 4 comments
Closed

Contract listener questions #132

jankrassnigg opened this issue Apr 13, 2022 · 4 comments

Comments

@jankrassnigg
Copy link
Contributor

When I visualize contacts, I see unexpected results.

Here is a box (if it doesn't play download the file and try with VLC, not sure what went wrong, but VLC works). The box falls down twice, once reporting contacts only on the ground, but the second time, it also reports a contact in the air (when it bounces back up).

contact.points.mp4

With the box it doesn't happen all the time, but with a sphere for the collision shape, I get this every time:

grafik

This is really weird, I don't see any reason why it should report a contact there.

And another question: This system is meant for impact sounds and so on. In PhysX the contact report gave me an "impulse" for each contact, so that I could determine how strong the impact was and pick a suitable reaction. Is that possible in Jolt? All I see is a penetration depth value, but I would expect this to be highly dependent on the framerate, rather than on the actual forces involved.

And yet another question: The ContactManifold structure holds mWorldSpaceContactPointsOn1+2. What's the dfifference? I would expect the manifold to be identical for both bodies involved, and since the points are given in world space, I don't see how these could ever differ? There is no helpful comment on the code about it.

@jankrassnigg
Copy link
Contributor Author

Btw. the video plays for me in Edge, but not in Firefox.

@jrouwe
Copy link
Owner

jrouwe commented Apr 13, 2022

  1. Can you maybe create a repro of this in the samples and send it to me? It looks like a bug, but I don't immediately see what it could be.
  2. The contact listener gives you both bodies that are colliding. The velocities of those bodies have not been modified at the time of the callback, so you can get them to calculate the impulse. The actual impulse depends on constraint solving and hasn't been calculated at that point yet, so you'll need to do an estimate.
  3. The difference between contact point 1 & 2 is that they're on the surface of both bodies. In an ideal case there won't be a penetration so the points will be the same, but when there is penetration, they will be different.

@jankrassnigg
Copy link
Contributor Author

  1. I tried ... and then figured out that I still had a sensor in my scene that moved into the object and created the contact point. Sorry about that.
  2. Great idea. I don't need the real impulse, I only need something to make a guess about whether it's a light touch or a heavy impact, so that should work.
  3. Makes sense then. I guess I can only look at one of the arrays then. Maybe you want to add that as a comment to the code.

@jrouwe
Copy link
Owner

jrouwe commented Apr 15, 2022

I added some extra documentation.

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

2 participants