I’m currently in the process of getting my performance to the target after I manged to put together a somewhat compleet proof of concept prototype.
On the client I use jme rays, to determine if I look at a useable object. I need at most a range like 10 meters for this.
In my current scene this needs around 70ms. Are the any possible optimisations possible with stock jme that can help improve the performance?
(I already use a very hard lod, does the raytest skip cullhint always objects?)
What I currently do is keep a list of spatials with the ActionControl on and manually check for the CullHint.
You could also do a pre sorting like “if distance > 10 skip”, but such a raytest doesn’t do more than “c = a + b * x” → solving to x for every c in the list, so I guess a distance check will take more or less the same power than the actual ray itself.
Other than that, you could use a Future<> to raytest or manually raytest 1/4th every frame and process the results after 4 frames, that way you can improve FPS.
(You could even mix both, so you have all four cores calculating, depends on your design though)
JME picking ignores cull hint… but it does work as zuegg suggests in that it ignores things where the ray misses the bounding shape.
That being said, if you only care if the object is hit and not specifically where it’s hit then it might be better to do your own picking based solely on bounding shapes… and then organize your ‘world’ spatially.