Game Development Reference
In-Depth Information
// Add a velocity to the position
vec3.scale(this.velVec, this.velVec, timeStep);
vec3.add(this.pos, this.velVec, this.pos);
}
if (vec3.squaredLength(this.angVel) > 0.0)
{
// Apply some rotations to the orientation from the angular
velocity
this.pitch(this.angVel[0] * timeStep);
this.yaw(this.angVel[1] * timeStep);
this.roll(this.angVel[2] * timeStep);
}
return true;
}
The preceding free camera code does not calculate the view
matrix. Each functionality just updates our vectors. We calculate
our view matrix in the apply function defined in the parent class.
Now, let's use our free camera in the scene that we created in Chapter 3 , Loading the
Game Scene .
Using our free camera
We want to view the scene from Chapter 3 , Loading the Game Scene , from different
angles and positions as shown in the following screenshot:
 
Search WWH ::




Custom Search