I get the error as said above, which prevents me from testing to see whether my camera is working. The code is:
protected override void Update(GameTime gameTime)
{
KeyboardState keyBoardState = Keyboard.GetState();
//Rotate Cube along its Up Vector
if (keyBoardState.IsKeyDown(Keys.X))
{
cubeWorld = Matrix.CreateFromAxisAngle(Vector3.Up, .02f) * cubeWorld;
}
if (keyBoardState.IsKeyDown(Keys.Z))
{
cubeWorld = Matrix.CreateFromAxisAngle(Vector3.Up, -.02f) * cubeWorld;
}
//Move Cube Forward, Back, Left, and Right
if (keyBoardState.IsKeyDown(Keys.Up))
{
cubeWorld *= Matrix.CreateTranslation(cubeWorld.Forward);
}
if (keyBoardState.IsKeyDown(Keys.Down))
{
cubeWorld *= Matrix.CreateTranslation(cubeWorld.Backward);
}
if (keyBoardState.IsKeyDown(Keys.Left))
{
cubeWorld *= Matrix.CreateTranslation(-cubeWorld.Right);
}
if (keyBoardState.IsKeyDown(Keys.Right))
{
cubeWorld *= Matrix.CreateTranslation(cubeWorld.Right);
}
}
The line causing an error is:
protected override void Update(GameTime gameTime)
You are not inheriting from GameComponent, you have two options:
Inherite your class from GameComponent:
Remove the ‘override’ keyword in your update method declaration: