Why does primitive Box doesn't use special support-function but instead falls back to discrete vertices ? #74
Replies: 2 comments 3 replies
-
Box uses the vertex representation because it is faster AND correct. In the case of spheres, capsules, cylinders, etc. the vertex representation might be faster, but it is not entirely correct. We would need an infinitesimal resolution if we want to make it correct. Having said that, I think the real support function should be faster if we had a properly compiled support function. Unfortunately, numba is not good at handling classes. Caching and inheritance are not supported. I am still interested in making the code faster, but at some point it is not possible anymore unfortunately... |
Beta Was this translation helpful? Give feedback.
-
I'm currently testing other collision detection libs too and those that support primitives seem to perform better when using primitives instead of approximated mesh vertices:
|
Beta Was this translation helpful? Give feedback.
-
I'm comparing distance3d performance with respect to using meshes ( vertices approximating a box, sphere, cylinder ) vs using primitives like
colliders.Box()
.When doing many collision tests, I noticed that the former ( meshes ) appears to be faster than the latter ( primitives ).
Looking into
colliders.Box()
I noticed that it doesn't seem to use the generic support functionsupport_function_box
but instead falls back to plain vertices, whereas the primitivecolliders.Sphere
uses the builtin functionsupport_function_sphere
.I.e.
colliders.ConvexHullVertices
colliding withcolliders.ConvexHullVertices
seems to be fasterthan
colliders.Box|colliders.Sphere|colliders.Cylinder
colliding withcolliders.ConvexHullVertices
.I even tried to patch
colliders.Box()
using the following implementation, but the results are the same (ConvexHullVertices
is faster than the other primitive types ):Beta Was this translation helpful? Give feedback.
All reactions