• Create Account

# Arc camera view disappears when reaching highest/lowest elevation

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

3 replies to this topic

### #1OpaqueEncounter  Members   -  Reputation: 119

Like
0Likes
Like

Posted 11 August 2012 - 05:00 PM

I have an arc camera that behaves like this:
[source lang="csharp"] Matrix translation = Matrix.Translation(-Vector3.UnitZ * cameraDistance); Matrix elevation = Matrix.RotationX(MathUtil.DegreesToRadians(CameraElevation)); Matrix orientation = Matrix.RotationY(MathUtil.DegreesToRadians(CameraOrientation)); Matrix translation3D = translation * elevation * orientation; Position = translation3D.TranslationVector; View = Matrix.LookAtLH(Position, Vector3.Zero, Vector3.UnitY);[/source]
It works like a charm, minus one issue. If I set the maximum/minimum elevation to 90/-90 degrees respectively, then once the camera elevation reaches that limit, whatever I am viewing, disappears. The "hackish" solution is to set the bounds plus/minus some very small value (0.0001f).
However, I would still like to know what this is happening, and if there is a solution that doesn't involve adding/substracting magic numbers.

### #2RulerOfNothing  Members   -  Reputation: 961

Like
0Likes
Like

Posted 11 August 2012 - 06:02 PM

I believe that it is because when the elevation reaches 90/-90 degrees the camera is pointing in the same direction as the up vector, so presumably the view transformation doesn't work (At 90 degrees, the up vector you use has a projection onto the viewport of zero length). What you could do is set the up vector to always be perpendicular to the position vector.

### #3OpaqueEncounter  Members   -  Reputation: 119

Like
0Likes
Like

Posted 11 August 2012 - 07:36 PM

I believe that it is because when the elevation reaches 90/-90 degrees the camera is pointing in the same direction as the up vector, so presumably the view transformation doesn't work (At 90 degrees, the up vector you use has a projection onto the viewport of zero length). What you could do is set the up vector to always be perpendicular to the position vector.

I transformed the position vector by +90 degrees about the X-axis and that seems to have fixed the problem. However, the camera view is now not what I expect it to be. The camera elevation works fine, but the orientation behaviour is completely erratic.

### #4OpaqueEncounter  Members   -  Reputation: 119

Like
0Likes
Like

Posted 14 August 2012 - 12:23 PM

Anyone?

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

PARTNERS