## Other ways to establish the point of viewIn Chapter 1, we talked about establishing the point of view by calling a single function, fg_3Dpov(). The problem with this function is it uses a concept called "Euler angles". That is, it processes 3 angles at the same time. It works, but it does not give you very much in the way of flexibility. There are better, more precise ways to establish a point of view.
The
If you have moved around in 3D space, and you want to know your
current position and direction of view, you can call
## Motion
You can change the position of your point of view without changing
the rotation by calling What if you just want to move forward a bit, without knowing exactly where you want to move to? Is there an easier way to do it? Yes, there is. You can try these functions for relative viewpoint moves:
There are similar functions for moving objects: Each of these functions expects you to pass a single value, which is the amount of the move. The units of this value will depend on how you have designed your 3D space, as described in Chapter 1. Note that you can move in other directions too. You can move backwards by calling fg_3Dmoveforward() and passing a negative value too it.
Similarly, passing a negative value to fg_3Dmoveright() or
fg_3Dmoveup will cause you to move left or down.
## RotationRotation is perhaps one of the hardest concepts for 3D programmers to understand. The mathematics of the 3D rotation matrix are explained here. Fortunately, you don't really need to know this stuff. We have taken care of the details of rotation for you in Fastgraph. To rotate your view or an object, all you need to do is call a few simple functions. Here are some suggestions.
For an absolute rotations without moving the viewpoint or the object,
call For relative rotations, try these for the viewpoint:
and try these similar functions for objects:
Note that fg_3Drotateright() will rotate either to the right or the
left. Just pass a negative value if you want to rotate to the left.
Similarly, fg_3Drotateup() will rotate down if you pass a negative
value. The fg_3Droll() function rolls around the current z axis,
or "Out" vector, which faces directly out from the screen. Calling this
function will cause the screen to rotate about a point in its exact
center.
## ConclusionUsing absolute and relative functions for moving and rotating your viewpoint and your objects gives you powerful capabilities. A complete set of these functions will allow you to write your own great 3D games. |

Introduction

Chapter 1 |
Chapter 2 |
Chapter 3

Chapter 4 |
Chapter 5 |
Chapter 6 |
Chapter 7

Appendix 1 |
Appendix 2 |
Appendix 3

Benchmarks

Fastgraph Home Page

This page written by Diana Gruber.