04-21-2020, 11:30 AM
Why you don't use the hit-testing that is part of the Ab3d.DXEngine?
OctTree in DXEngine is designed for organizing triangles inside complex meshes so hit testing can work very fast - without checking the ray to triangle intersection for each triangle in the mesh (that can have millions of triangles). It cannot be used to store many objects and do a hit test on them.
But usually number of objects does not go into millions. If you have a few thousands of objects, then you can do manual hit testing with checking if ray hits the bounding box (checking all objects) and then in case of intersection do a mesh intersection test. This should be still very fast on a modern CPU.
If you use transformations to animate your objects, then you do hit testing in such a way that you transform the original camera's ray with the inverse world transform of the object.
OctTree in DXEngine is designed for organizing triangles inside complex meshes so hit testing can work very fast - without checking the ray to triangle intersection for each triangle in the mesh (that can have millions of triangles). It cannot be used to store many objects and do a hit test on them.
But usually number of objects does not go into millions. If you have a few thousands of objects, then you can do manual hit testing with checking if ray hits the bounding box (checking all objects) and then in case of intersection do a mesh intersection test. This should be still very fast on a modern CPU.
If you use transformations to animate your objects, then you do hit testing in such a way that you transform the original camera's ray with the inverse world transform of the object.
Andrej Benedik

