Performance questions regarding raycasts and static bodies #1515
-
Hi, as always, greatly enjoying Jolt, and got a few generic questions, would appreciate any answers or hints.
Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
No narrow phase query does a broad phase check before a narrow phase check. I couldn't come up with a better name. There is BroadPhaseQuery which only checks against the broadphase and I found BroadAndNarrowPhaseQuery a bit long.
Correct.
Not really. The CastRay with RayCastResult implementation is quite limited and I'm tempted to remove it. The only reason it still exists is because it offers a faster ray vs mesh implementation (SIMD style). For the broadphase there is no such advantage.
The cost of ray casts scales with the number of bodies and the number of triangles it encounters. Long rays tend to hit more bodies than short rays, so they tend to be more expensive. A
In general I would say that a few bodies with a mesh shape is probably more efficient than many bodies with simple convex shapes. If you want to use simple convex shapes (e.g. because you want your walls to be solid) then combine them into static compound shapes to reduce the number of bodies to a couple of bodies per room. Again, these things really depend on what you're doing with them so you'd need to profile. |
Beta Was this translation helpful? Give feedback.
No narrow phase query does a broad phase check before a narrow phase check. I couldn't come up with a better name. There is BroadPhaseQuery which only checks against the broadphase and I found BroadAndNarrowPhaseQuery a bit long.