Tech Off Post

Single Post Permalink

View Thread: Discuss the Beginning Game Development series on Coding 4 Fun
  • User profile image
    MadKiwi

    Great tutorials, I have learnt a lot.

    I noticed a couple of things:

    The formula for strafing in the Tutorial 6 C# code seems to be wrong.

    Change this line in the MoveCameraPosition method:

    _z += z * (float)Math.Cos(_heading) + x * (float)Math.Sin(_heading);

    to:

    _z += z * (float)Math.Cos(_heading) - x * (float)Math.Sin(_heading);

    Also, because of the rounding in this division the camera doesn't move when you move the mouse slowly. To change this change the following (in GameEngine.cs):

    _camera.MoveCameraLeftRight(_mouse.State.X / 10); _camera.MoveCameraUpDown(_mouse.State.Y / 10);

    to:

    _camera.MoveCameraLeftRight(_mouse.State.X / 10f); _camera.MoveCameraUpDown(_mouse.State.Y / 10f);