racer home

Car cameras

 

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


Dolphinity Organiser - free planning, project management and organizing software for all your 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. You can also create real 3D cockpits. Car cameras can be selected in car camera mode (use the C key to toggle between all camera modes until you get to the car camera mode) and pressing 0..9 to select a camera.

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 rendering performance. Use '1' to show them in this view.
steering_wheel Since Racer v0.9.0 RC5, you can explicitly turn the steering wheel model on or off. Use 0 for off, 1 for on.
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 3 camera types: fixed, from-to (or SMD for spring-mass-damper) and head. 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. This can be a bit hard to tweak, so for head type movements there is the 3rd type; head.

Camera type: fixed

This type of camera is quite static - it clings to the car, defined by 3 'follow' parameters. A detailed explanation of the parameters 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 (or SMD, for spring-mass-damper)

This camera type is fundamentally a look-at system. Two points, the from point and the to point, are really invisible masses with springs & dampers attached. The camera is then located at the 'from' point, and looks in the direction towards the 'to' point.

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 detected/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.

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 (1 kilogram).
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 The same parameters as 'src', but for the 'to' point.

 

Camera type: head physics (v0.8.44+)

This type of camera is useful when trying to simulate the head. It has 6 degrees of freedom; positional and rotational. Each axis has a separate spring attached so you can tune them independently.

The basis is a head with a mass of 6 kg. The input for the springs is the car's linear acceleration.

Parameter Description
offset.x/y/z

The offset of the camera from the car center. The direction is currently always forward.

head_physics.lateral.k Lateral spring rate.
head_physics.lateral.damp Lateral damping rate.
head_physics.lateral.max Max deflection (in meters).
head_physics.vertical.k/damp/max Vertical spring properties; see head_physics.lateral for detailed description.
head_physics.longitudinal.k/damp/max Longitudinal spring (forward/backward).
head_physics.yaw.k/damp/max Rotational spring properties for yaw acceleration.
head_physics.pitch.k/damp/max Pitch spring properties.
head_physics.roll.k/damp/max Roll spring properties.

 

More reading material

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


Dolphinity Organiser - free planning, project management and organizing software for all your action lists

(last updated November 13, 2012 )