Download presentation
Presentation is loading. Please wait.
Published byRosemary O’Neal’ Modified over 9 years ago
1
The Camera Course Information CVG: Programming 4 My Name: Mark Walsh Website: www.activehelix.co.uk/courseswww.activehelix.co.uk/courses Recommended Reading Introduction to 3D Game Programming with DirectX 9.0 (Frank D. Luna)
2
Re-Cap Local Space World Space View Space
3
Local Space
4
World Space
5
View Space
6
Flexible Camera Class Objective is to build a flexible FP based games camera: Flight Simulators and Shooters The first stage is camera design
7
Camera Design The camera position is defined relative to the world coordinate system using 4 vectors Right, Up, Look, Position They define a local coordinate system relative to the world coordinate system
8
Camera Picture:
9
Vectors: Right, Up and Look define the cameras orientation in the world They are therefore the orientation vectors The orientation vectors must be orthonormal –Mutually perpendicular to each other –Of Unit Length A row matrix where the rows are made up of orthonormal vectors is orthagonal
10
Camera Operations Using the 4 vectors we wish to be able to: Rotate around the right vector or X axis (Pitch) Rotate around the up vector or Y axis (Yaw) Rotate around the look vector Z axis (Roll) Strafe along the right vector Fly along the up vector Move along the look vector
11
Implementation We calculate the view matrix using the camera vectors Remember that view space transforms the geometry in the world… …so that the camera is centred at the origin and the axes are aligned with the major coordinate axes
12
Rotation About Arbitrary Axis Pitch Yaw Roll
13
Rotation D3DXMatrixRotationAxis Angle in Radians to Rotate Rotate around arbitrarily defined vector
15
Walking, Strafing, Flying Walking = Moving along the Look vector Strafing = Moving along the Right vector Flying = Moving along the Up Vector
16
To move we add a vector to our position vector The should have the same direction Need to set restrictions –Walking, flying distinctions
17
The End
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.