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

distance
name
number
type
How far the camera is from the vehicle.
number
type
How close from the vehicle the camera can get.
offset
name
table
type
The offset of the camera’s focus point
If set at 0,0,0, the camera’s focus point will be the refnode.
fov
name
number
type
Default field of view of the camera.

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

distance
name
number
type
How far the camera is from the vehicle.
number
type
How close from the vehicle the camera can get.
table
type
The rotation of the chase camera.
offset
name
table
type
The offset of the camera’s focus point
If set at 0,0,0, the camera’s focus point will be the refnode.
fov
name
number
type
Default field of view of the camera.

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

type
name
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.

x
name
number
type
The X position of the camera node.
y
name
number
type
The Y position of the camera node.
z
name
number
type
The Z position of the camera node.
fov
name
number
type
The default field of view of the camera.
id1:
name
string
type
The first node that the camera node will be linked to with a beam.
id2:
name
string
type
The second node that the camera node will be linked to with a beam.
id3:
name
string
type
The third node that the camera node will be linked to with a beam.
id4:
name
string
type
The fourth node that the camera node will be linked to with a beam.
id5:
name
string
type
The fifth node that the camera node will be linked to with a beam.
id6:
name
string
type
The sixth node that the camera node will be linked to with a beam.

Optional arguments

nodeWeight
name
number
type
The weight of the camera node
boolean
type
If the camera node has collisions with the rest of the vehicle.
collision
name
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.
beamSpring
name
number
type
The rigidity of the beams linking the camera node to the rest of the vehicle.
beamDamp
name
number
type
The damping of the beams linking the camera node to the rest of the vehicle.
beamDeform
name
number
type
How much force is required to deform the beams between the camera node and the rest of the vehicle.
number
type
How much force is required to break the beams between the camera node and the rest of the vehicle.
idRef
name
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.
idBack
name
string
type
Node name of a node behind the secondary refnode.
This should be used along with idRef and idUp.
idUp
name
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: 28 November 2021, at 22:06

Any further questions?

Join our discord