17.CameraAnimator
The idea of this animator cames from the example 'Demo'.
Unzip the new example '17.CameraAnimator' to the directory 'examples'.
Compile project 'example' and run program. Enjoy this new demo.
Press [ESC] to exit.
After you have seen the first pass then press [H] to get a list of keys:
[A]utoreverse (repeat must be off)
[D]irection (forward/backward)
[H]elp (on/off)
[M]otion (on/off)
[R]epeat (on/off)
[T]angents (on/off)
[W]aypoints (on/off)
[X] Restart
[1-4] Decrease speed (at next node)
[-5-] Normalize speed (at next node)
[6-9] Increase speed (at next node)
Press [W] to see the way!
The new animator supports the following features:
- Unlimited waypoints (connected using bezier curves).
- The radius of the curves can be defined by two tangents and their auxiliary range.
- Fill a list of points showing the way between the waypoints. Press [W] in demo.
- Fill a list of waypoints and their tangents. Press [T] in demo.
- Calculation of length of the full way or a part of way.
- The way can be joined to a endless loop. Set repeat=true.
- Moving between a start and end waypoint. Set repeat=false, autoreverse=true
- Every waypoint can have its own speed and camera mode.
- A master speed is used to speed up or down movement.
- Changing direction while moving.
- Start/stop moving at any time.
- Different camera modes (if a camera has been attached to the animator):
+ looking to a fixed point (at the begin of the demo)
+ looking to a (moving) scene node (at the end of the demo - look at the prism)
+ looking ahead in moving direction (in the middle of the demo)
Attention:
The view of camera will be unpredictable if the movement is straight to the top/bottom.
To avoid this effect use a vector of e.g. (0.1, 1.0, 0.0).
Some examples of usage:
- Moving your camera through a demo scene while preparing for a new game.
This camera may look to some of your 3d-modells while flying by.
- Moving vehicles if they are following a fixed way.
- Moving a lift/elevator.
New event receiver:
This example uses a main class (useful for examples) and a new event receiver class.
The class XExampleEventReceiver simply stores the pressed key codes while the class
XUserCodeEventReceiver is able to translate key codes into user defined codes (s32).
I think this is the correct way if key codes may be changed by user. In this case you
have to change the translation table only. Note that this class is not tested yet.
Maybe I will design a advanced class to translate groups of key codes.
e.g. "ctrl+C, X" to activate a command (ctrl+c) and then choosing the command by
pressing the next key seen in games using a large amount of keys.
Note that every event receiver class is a event distributor too. Insert other event
receiver into your main event receiver if you want. Unhandled events are distributed
to the event receiver stored in the internal list.
Dateianhang:
Dateikommentar: (source code)
17.CameraAnimator.zip [35.58 KiB]
1064-mal heruntergeladen