BigTruck's Fan Page

BOD Python Scripting

09 - Cutscenes and camera stuff

In most of the cutscenes in the main game the camera moves are handled by hard-coded *.cam files which are created in 3dsmax.

However, it is easy to create them with Python.

What you need are sets of coords. The "Camera" is an entity the same as all other objects in the game. The two properties you need are:

Position (the position of the camera)
TPos (target postion - the point at which it is 'looking')

You need the De-bug mode enabled in order to get accurate coords. Start the map and press 'P' to enable the free camera. You now need to set some key points in the camera travel path.

Move the cam to the point where you want to start your cutscene. Press 'T' until you get a readout with the camera position and camera target position. (This screen has lots of other stuff on it: Player Pos/Angle and current animation,etc). Write down the cam pos and tpos. Move cam to the next stage in its path, note coords again and repeat until you reach the point where you want the cutscene to end.

There is a file Lib/AbreCam.py that handles camera moves nicely. To use, make a function:
			import AbreCam

			def Cut1():
			   AbreCam.ResetNode()
			   AbreCam.AddNode((10000, -6000, 80000),(12000,-10000, 67000),0)
			   AbreCam.AddNode((20000, -8000, 70000),(12000,-10000, 67000),7)
			   AbreCam.AddNode((30000, -7000, 86000),(9000,-4000, 56000),8)
			   AbreCam.AddNode((50000, -6000, 98000),(8000,-5000, 40000),4)
			   AbreCam.LastTime=0
			   AbreCam.AbreCam()
Add as many 'Node's as you wish. Each one contains the camera Position followed by the camera TPos. Put in the coords you wrote down earlier.

The last arg is the time it takes to complete the move.

In this case it is set to 0 in the first line. When func is called (usually from a trigger sector) the camera moves instantly to the first position. If you set the first time to greater than 0 the camera moves from the current Player veiw to first pos in this time. But, because you cannot be sure just where the Player may be looking at this point, it is better to leave the time at 0 to avoid weird things happening.

The camera next moves to the second position, in this case in 7 secs. Then it does all the other moves in order. If the LastTime is set to 0, the cam returns to the Player instantly after the last position is reached. If you set this to greater than 0 it will travel back to the Player in that amount of time. Again, this is best set to 0 in most cases. During the cut, the keyboard input is disabled and the scorer is hidden.

Sometimes this code is a bit restricting and cam moves can be done in other ways, but this is the best method in the majority of situations.