Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualATC

Posted 26 October 2012 - 06:31 PM

I was just considering what the implications of a different approach to designing a camera base class might be...

[source lang="csharp"]// Traditional approach ::class CameraTraditional{ public Vector3 Up { get; set; } public Vector3 Target { get; set; } public Vector3 Position { get; set; }};// A different approach ::class CameraDifferent{ public Vector3 Position { get; set; } public Quaternion Orientation { get; set; }};[/source]

The pseudo-code example says it all... Normally, we implement a "camera" object with the properties "Up", "Target" and "Position" for creating a view matrix. But what if we toss that notion out and go with something more akin to any other 3D game entity, which has a "Position" and "Orientation" rather than calculating everything in terms of what direction is up and where the target is...?

What problems might this pose in game design? What advantages might it have? I was just curious about this idea so figured I'd ask...

Regards,

--ATC--

EDIT:

Also, what is the easiest way to decompose a projection matrix to retrieve the fov, aspect ratio and near/far clipping planes?

#1ATC

Posted 26 October 2012 - 06:26 PM

I was just considering what the implications of a different approach to designing a camera base class might be...

[source lang="csharp"]// Traditional approach ::class CameraTraditional{ public Vector3 Up { get; set; } public Vector3 Target { get; set; } public Vector3 Position { get; set; }};// A different approach ::class CameraDifferent{ public Vector3 Position { get; set; } public Quaternion Orientation { get; set; }};[/source]

The pseudo-code example says it all... Normally, we implement a "camera" object with the properties "Up", "Target" and "Position" for creating a view matrix. But what if we toss that notion out and go with something more akin to any other 3D game entity, which has a "Position" and "Orientation" rather than calculating everything in terms of what direction is up and where the target is...?

What problems might this pose in game design? What advantages might it have? I was just curious about this idea so figured I'd ask...

Regards,

--ATC--

PARTNERS