Jme uses a pretty sophisticated method for raytracing called the BVH Tree.
That basically means: “If it’s parent node’s world bounds/bounding box doesn’t collide, then the children won’t either”.
That’s pretty good but unfortunately tied completely to the SceneGraph.
I have the following problems with it:
- The first raycast (Tree generation) freezes the game for a short amount of time
- I would want to avoid re-generation of trees if I’m tracing different things.
- I’d love to run it in another thread.
So really my question is if there is any “tree object” at all to cache or which is discarded? I have the feeling that 1. is simply when the bounding volumes for the whole Scene Graph are calculated?
My use-case is an entitysystem with “interactables”, that means elements in the scene which you can interact with by pressing “E”. For this I’d build up my own “scene graph”/tree, but I don’t want this to infer with “rootNode collision for shooting bullets”.
I guess I’d be fine by just doing it since the only calculation will be the worldBounds?
So the only drawback would be 3, because worldBounds change with the Transforms and it would be writing to Nodes? Would it be a problem if inside the update loop multiple raycasts run in parallel? Apart from maybe duplicate calculation of worldBounds? Or if worldBounds are calculated, could I run them in parallel?