Check if a Spatial is completely shown

Hi,



is there any method to check if a spatial is completely shown? I mean, if you have a box and you are too close to one of the sides you could not see all the side but only a part, is there any method to check if you are having a full view of the spatial? Maybe something like checking if the camera limits are intersecting with the object





Thanks

You can use Camera.contains() method, make sure you set the check plane of the bounding volume to 0 before you call the method though

Thank you, I’m using Camera.contains() but I’ve a problem, once the method returns “Inside” it keep returning it even when the Spatial is outside. If the method returns the first time “outside” I can move the camera and get “intersects” or “inside”, and if the method returns the first time “intersects”

I can move the camera and get “outside” and “inside”.





That is my code:



[java]BoundingVolume bv=sp.getWorldBound();



int planeState = bv.getCheckPlane();

bv.setCheckPlane(0);

System.out.println(viewPort.getCamera().contains(bv));

bv.setCheckPlane(planeState);[/java]

I think you also need to call camera.setPlaneState(0), forgot about that :slight_smile:

Thanks that solved my problem

This should be added as a snippet. :slight_smile: