I have a quadtree set up for all static collision objects, which works great for both collision detection and raycasting
However, as I also have non-static collision objects, when I raycast I'd like to include them as possible collidable objects for the ray
What would be the best (in terms of performance) way to achieve this? My current ideas are:
1) clone the quadtree, add the non-static objects, then use that for the raycast
2) add the non-static objects to the current quadtree, with some flags that basically prevent the quadtree from splitting up its quads even if there are more children than allowed in a quad. The quadtree would then have to "clean up" after itself once the raycast is complete
3) after determining the closest static object collision (using the quadtree), just iterate through all non-static objects and see if the ray collides with them, and then check to see if the collision point is close than the closest static object collision point
All of these ideas seem a bit cumbersome though, so I'm looking for any alternative ideas that could be more performant
In case it matters, I'm using Java