Camera

There are 3 different sections of cameras within jbeam. The cameraExternal, refering to the orbit camera, cameraChase refering to the chase camera, and cameraInternal, which is used for the dash, hood and other custom cameras.

CameraExternal and CameraChase should both be defined within the same component as the refnodes (usually the frame or body of a vehicle depending on its construction), but in some cases they can be re-defined by other parts such as the H-Series’ cargo box upfit, to allow the player to see over it.

With all of these, when you make changes, you might need to change cameras after doing reloading the jbeam for the changes to take effect.

cameraExternal

The external camera refers to the orbit camera. It is defined using the refnode as the center point, and can be rotated freely by the player.

Required arguments

number
type
How far the camera is from the vehicle (m).
number
type
How close from the vehicle the camera can get (m).
dictionary
type
{“x”:0, “y”:0, “z”:0}
default
The offset of the camera’s focus point (m).
If set at 0,0,0, the camera’s focus point will be the refnode.
number
type
Default field of view of the camera (degrees).

Example

"cameraExternal":{
    "distance":4.5,
    "distanceMin":1.5,
    "offset":{"x":0.0, "y":0.2, "z":0.45},
    "fov":65,
},

cameraChase

The chase camera has a mostly fixed rotation behind the car. It is defined using the refnode as the center point.

Required arguments

number
type
How far the camera is from the vehicle (m).
number
type
How close from the vehicle the camera can get (m).
dictionary
type
{“x”:0, “y”:0, “z”:0}
default
The rotation of the chase camera (degrees).
dictionary
type
{“x”:0, “y”:0, “z”:0}
default
The offset of the camera’s focus point (m).
If set at 0,0,0, the camera’s focus point will be the refnode.
number
type
Default field of view of the camera (degrees).

Example

"cameraChase":{
    "distance":4.5,
    "distanceMin":1.5,
    "defaultRotation":{"x":0, "y":-11.2, "z":0},
    "offset":{"x":0.0, "y":0.2, "z":0.7},
    "fov":65,
},

camerasInternal

Internal cameras are mostly used for the hood and interior cameras, however they can also be used to set-up custom camera views, like a fender camera.

Unlike the other two cameras, which use the refnodes as their reference, internal cameras are set-up as nodes connected to the rest of the vehicle with 6 beams.

This allows us to adjust the stiffness of the camera, so the interior camera can sway under acceleration, braking and cornering forces.

Internal cameras will always keep the same angle compared to the refnode as the camera node moves, meaning that, for example, if the camera moves forward, it will point down. It is possible if required to define a secondary set of refNodes using the “idRef”, “idBack” and “idUp” properties. This is mostly used for vehicles with a rotating turret, to allow the camera to rotate with the turret.

Required arguments

string
type
Default field of view of the camera.

The typically used types are “hood” and “dash”, however this can be set-up to any value for custom cameras.

“dash” and “driver” are used specifically to the main interior camera of the car, with special behaviors when looking back.

“dash”, “driver” and “rider” types will enable interior muffling around a certain distance from the camera.

number
type
The X position of the camera node.
number
type
The Y position of the camera node.
number
type
The Z position of the camera node.
number
type
The default field of view of the camera.
string
type
The first node that the camera node will be linked to with a beam.
string
type
The second node that the camera node will be linked to with a beam.
string
type
The third node that the camera node will be linked to with a beam.
string
type
The fourth node that the camera node will be linked to with a beam.
string
type
The fifth node that the camera node will be linked to with a beam.
string
type
The sixth node that the camera node will be linked to with a beam.

Optional arguments

number
type
The weight of the camera node (kg).
boolean
type
If the camera node has collisions with the rest of the vehicle.
boolean
type
If the camera node has collisions with the world and other vehicles.
boolean
type
false
default
If the camera is for a right hand drive vehicle.
Causes the view outside of the side window to be to the right instead of the left.
number
type
The rigidity of the beams linking the camera node to the rest of the vehicle (N/m).
number
type
The damping of the beams linking the camera node to the rest of the vehicle (N/m/s).
number
type
How much force is required to deform the beams between the camera node and the rest of the vehicle (N).
number
type
How much force is required to break the beams between the camera node and the rest of the vehicle (N).
string
type
Allows the definition of a secondary refnode for the camera to use as a reference point.
This should be used along with idBack and idUp.
string
type
Node name of a node behind the secondary refnode.
This should be used along with idRef and idUp.
string
type
Node name of a node above the secondary refnode.
This should be used along with idBack and idRef.

Example

    "camerasInternal":[
        ["type", "x", "y", "z", "fov", "id1:", "id2:", "id3:", "id4:", "id5:", "id6:"],
        {"nodeWeight":1.24},
        {"selfCollision":false},
        {"rightHandCamera":true},
        {"collision":false},
        {"beamSpring":46000,"beamDamp":435},
        //hood cam
        ["hood", 0.0, -0.64, 1.20, 65, "f7r","f7l","c3r","c3l","p1r","p1l", {"beamDeform":5001000,"beamStrength":"FLT_MAX"}],
        {"beamSpring":400,"beamDamp":75},
        {"selfCollision":true},
        {"collision":true},
        //dash cam
        ["dash", -0.343, 0.18, 1.23, 55, "f1rr","f2l","f3rr","f4rr","f4ll",[], {"beamDeform":5001000,"beamStrength":"FLT_MAX"}],
    ],
Last modified: July 10, 2024

Any further questions?

Join our discord
Our documentation is currently incomplete and undergoing active development. If you have any questions or feedback, please visit this forum thread.