Car cameras

 

Home A John Player Special Lotus from 1970 in one of the oldest versions of Racer.


Dolphinity Organiser - free planning and organizing software for all your todo and action lists
Introduction

You have 10 car cameras at your disposal. Normally, the first few are outside views, the later ones, especially 9 and 0, are incar views. From v0.4.8 on you can create real 3D cockpits. Car cameras can be selected in car camera mode and pressing 0..9.

Defining car cameras takes a bit of tweaking in the car's car.ini file. The definitions are placed under camera<n>.*. The parameters are as follows:

Parameter Description
name Logical camera name (such as 'Rear'). Isn't used yet really.
model

Select car 3D model to use in this camera view. 0=full car model (car.ini's body.model), 1=in-car model (body.model_incar) and 2=no model (useful for bumpercams for example). The in-car model can be used to boost performance if you only want a cockpit to be visible for example. It also makes it possible to use a more detailed cockpit than what you model in your full car.

Model 0 is used when you select the track camera (camera modes are switched with 'c' ingame).

wheels Defines whether the wheels are visible. Turning this off (set it to '0' without the quotes) can enhance performance. Use '1' to show them in this view.
fov Field of view, in degrees. Something between 40 and 80 is realistic. Using a higher value gives a sense of more speed, at the cost of perception of depth. Mostly this is a bit of a personal preference, but values between 50 and 70 are most common, where 50 seems a good approximation of the human eye, although for a 'faster' feel something closer to 70 gives a feeling of driving hard. Too much or not enough FOV may increase the chance of motion sickness.

There are 2 camera types: fixed and from-to. The fixed type is hooked statically to the car, whereas the from-to type is more loosely coupled, so it moves more with respect to the car body.

Camera type: fixed

This type of camera is quite static - it clings to the car, defined by 3 'follow' parameters. A detailed explanation follows:

Parameter Description
offset.x/y/z

The offset of the camera from position. Note that (due to legacy reasons), Y is negated. X & Z are more logically defined as an offset from the car in car coordinates. For example: offset.x=1, offset.y=-1, offset.z=-3 will place the camera behind the car, to its left and above (y=-1). The viewing direction is determine by the angles.

angle.x/y/z

Angle of viewing. Normally (all 3 parameters set to zero) it will look from the front of the car to the back of the car. So the camera location (offset.x/y/z) would indicate the camera from position is in front of the car.

X means pitch (in degrees), Y means yaw and Z is roll. So a good start for a camera that is located at the rear of the car would be: angle.x=15 and angle.y=180. The 180 (half a circle) is used to point the camera from the back of the car to the front.

follow.pitch Lets the camera follow the pitch of the car (if set to 1).
follow.yaw If 1, lets the camera follow the car's yaw. Often preferred to be 1.
follow.roll If 1, lets the camera follow the car's roll angle.

 

Camera type: from-to

This camera type is fundamentally a look-at system. 2 points, the from point and the to point, are really invisible masses with springs & dampers attached.

Both points are hooked to the car using this spring-mass-damper system; as the car moves and rotates, the optimal points (where the points would be when the car is not moving) move away from the from and to points. The points are then drawn to their optimal points using the springs, giving a more smooth movement of the camera. This gives a better feel of the amount of rotating/spinning the car is doing than the fixed cameras normally provide.

This type of camera is automatically used if you define the 'src' parameters (instead of the fixed type).

Parameter Description
offset.x/y/z

Offset from car (in local car coordinates) where the camera is in rest conditions.

offset_to.x/y/z Offset of the 'to' look-at point (in local car coordinates). The default is (0,0,0), which is the center of the car.
src.mass The mass (in kilograms) of the virtual from point. 1 is a good base value.
src.k The spring constant; forces applied to the from point will be force=src.k*distance_to_optimal_point. So as the car moves, its optimal source/from point moves. The camera then tries to catch up by applying these forces. A good start value is around 70.
src.damping The damper coefficient. Adds forces like a regular damper: forceDamping=srcVelocity*src.damping. Use this to avoid back & forth motion as the camera from location moves (if the car moves). Start with 15 for example.
src.maxdist

An absolute distance that the camera from location can move away from its optimal point. This can be used to avoid hefty movements from letting the camera 'escape' the desired radius. It's also useful when you have a soft spring but still want to avoid the camera moving too far away.

If exceeded, the distance will be clamped to the max distance defined here.

dst.mass/k/damping/maxdist  

 

More reading material

More information on creating a full car can be found here.


Organiser -planning, organiser and time billing software

(last updated May 28, 2010 )