Camera planes

Hi All,

I’m needing the left/right/top/bottom planes used to describe the view in order to check whether everything is inside it or not (for automatic camera positioning). The planes in the camera are in a protected field so I can’t access them without creating a sub-class - but if I don’t access them I’m not sure what values I need to extract from the camera and where to feed them into the Plane.

[java] Plane plane = new Plane(cam.getLeft(), cam.getFrustumLeft());


If I’m reading things right cam.getLeft() will give me the correct normal for the plane, but I’ve no idea if thats the right value for the constant - and also if there is anything else I need to do to map the plane over to world co-ordinates. The code in onFrameChange seems to be doing a lot of maths to work out the required values which makes me think it’s not quite that simple.

Ideally I guess a

[java]public Plane getLeftPlane() {

return worldPlanes[LEFT_PLANE];

} [/java]

method would be best for me. I couldn’t even implement that in a subclass though as the LEFT_PLANE etc indexes into the array are all private.

If I submitted a patch adding those methods to would anyone have an objection? Is there a reason the planes aren’t visible to the outside world?



“Constant” is poorly named in this case. The “constant” of a plane is the plane’s distance from the origin along its normal. So if you were to create your own plane, you just need to calculate its distance. Camera does that like this: