-
Notifications
You must be signed in to change notification settings - Fork 807
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
Sweep query penetrates triangle mesh #501
Comments
That's unexpected and it looks like a bug. Would you have a repro by any chance? Like maybe that mesh as a OBJ file? |
Sure. Here it is. The capsule has 1 height and 0.5 radius, and is algned with Y axis. |
Oh, sorry, I think I forgot to triangulate the mesh before exporting. >_< In my simulation I use triangulated version, I have uploaded it . Checked it in Blender, I think it should be ok now. Some vertices are duplicated, but that should be fixed during welding I assume, I have it enabled. P.S. To clarify regarding Unity: I am using Unity for visualization only in this case, the physics simulation is running in a separate process and uses native physx. That being said, I can reproduce the same behaviour with default Unity physics (which uses Physx internally as I am sure you are well aware :) ). |
I am using 4.1.2 (the latest commit in 4.1 branch).
|
Same code but with very small rotation added to mesh actor produces correct block distance:
|
I figured out how to use pvd, so I have also uploaded a pxd2 recording, maybe that one would help with repro. |
I can reproduce this now. I'll need some time to investigate what's going on, as the issue is not immediately clear. |
Good to hear! This bug is not a show stopper for us, but it would be nice to learn what causes this, so we can come up with decent workaround (if not straight up fix the issue). Let me know if you find anything. And thanks. |
FYI I fixed this one in PhysX 5 now. Not sure if/when the fix would be back-ported to PhysX 4 though. |
Good news. Sadly, we can not migrate any time soon. Any chance you can share some details about what caused this problem and what fixed it? Maybe it will help us come up with a workaround. |
This approach where we raycast against either a sphere or a capsule doesn't seem to work all the time: https://github.com/NVIDIAGameWorks/PhysX/blob/4.1/physx/source/geomutils/src/sweep/GuSweepSphereTriangle.cpp#L119 I tried several ways to improve it, nothing really worked. In the end I had to ditch it and use up to 2 raycasts-vs-capsule instead. It made the sweeps slower so I also rewrote the ray-vs-capsule code to recover lost perf. |
I think with the sweep direction, only 1 raycasts-vs-capsule needed. The code below show this.
|
Hi, again! I have noticed a strange behavior of sweep queries that I struggle to understand. The setup is simple: I perform a capsule sweep against a scene with a single static one-sided triangle mesh. The capsule is vertically aligned, and the cast direction is down, aka (0, -1, 0):
However the blocking hit reported by sweep query does not look correct. If I move the capsule at reported distance, the capsule penetrates the mesh considerably. On image below the shortest depenetration distance is ~0.06m, and if i try to depenetrate parallel to the cast direction, it would take a good ~0.5m (= the capsule's radius):
I've checked that normals are correct, tried using a double sided mesh, tried precise sweep option, tried all combinations of cooking options, nothing seemed to help with the issue.
What did help is tilting the mesh like 0.01 degrees around X axis. Apparently doing that helps PhysX detect the edge correctly and results in no penetration:
So my questions are:
The text was updated successfully, but these errors were encountered: