[Solved] Determining which LOD a camera sees?

Is there a way to determine which LOD a given camera sees?

I’d like to know because I wish to use the collision system to determine what the user is clicking on, and what the user sees varies depending on which LOD the LODnode is displaying to a camera. The way I was thinking about doing it was to look up which LOD the camera sees, and then set the collision mask for the ray coming from that camera appropriately.

If there is no built-in function to determine what LOD a given camera sees, one way to do it may be just to calculate the distance from the camera to the LOD node and go from there. But I’d rather not re-invent the wheel.

Also, I’m open to other methods of mouse picking that would respect the LOD.

Thanks!

I certainly let this hang around longer than I intended, especially since it’s such a straightforward fix. I ended up just setting a collision bitmask on the appropriate node under the LOD node path and then running the collision detection with that bitmask. Here’s the relevant code (run on every relevant LOD NP, before every relevant collision detection):

        dsq = (camera.getPos(self.base.render) - self.lod_np.getPos(self.base.render)).lengthSquared()
        if dsq < LOD_SWITCH_SQ:
            self.np0.setCollideMask(mask)
            self.np1.setCollideMask(0x0)
        else:
            self.np0.setCollideMask(0x0)
            self.np1.setCollideMask(mask)

where camera is the camera, LOD_SWITCH_SQ is the square distance of the LOD switching, self.lod_np is the LOD node path, and self.np0/1 are the node paths at the different LODs.