Hello,

I'm curious about the behaviour of my camera class. It is a simple class that controls camera view. It behaves like it should, except when the radius happens to be the maximum value that I've set in code (farPlaneDistance). When the mouse wheel is moved, this changes the near and far plane distance:

// don't get too far

if (radius < nearPlaneDistance)

{

radius = nearPlaneDistance;

}

// don't get too close

if (radius > farPlaneDistance)

{

radius = farPlaneDistance;

}

And I use the radius to update the position vector of the camera:

// update position vector

position.X = (float)(radius * Math.Cos(vertical) * Math.Cos(horizontal));

position.Y = (float)(radius * Math.Sin(vertical));

position.Z = (float)(radius * Math.Cos(vertical) * Math.Sin(horizontal));

And, last but not least, the public property for the camera projection matrix is:

public Matrix Projection

{

get

{

return Matrix.CreatePerspectiveFieldOfView(fieldOfView, AspectRatio, nearPlaneDistance, farPlaneDistance);

}

}

The field of view is PiOver4, and doesn't change.

My model objects are using stock code with basic effects. What I find odd is that if I reduce the radius to below what I've set as my far plane distance, then objects render fine. It doesn't seem to matter about model scale compared to hard values, etc., if I change values then the weird rendering just follows when radius == farPlaneDistance, it seems to be value agnostic.

Any suggestions as to where I'm going wrong, or if I should be looking at other code