Rigs of Rods 2026.01
Soft-body Physics Simulation
Loading...
Searching...
No Matches
Script2Game::BeamClass Class Reference

Description

Binding of RoR::Actor; a softbody-physics gameplay object, can be anything from soda can to space shuttle.

Definition at line 14 of file BeamClass.h.

Public Member Functions

Physics state
TruckState getTruckState ()
 
vector3 getPosition ()
 
vector3 getVehiclePosition ()
 
float getRotation ()
 
float getHeadingDirectionAngle ()
 
quaternion getOrientation ()
 
float getSpeed ()
 
vector3 getGForces ()
 
float getTotalMass (bool withLocked)
 
float getDryMass ()
 
float getLoadedMass ()
 
float getInitialDryMass ()
 
float getInitialLoadedMass ()
 
int getNodeCount ()
 
vector3 getNodePosition (int nodeNumber)
 
float getNodeInitialMass (int nodeNumber)
 
float getNodeMass (int nodeNumber)
 
vector3 getNodeVelocity (int nodeNumber)
 
vector3 getNodeForces (int nodeNumber)
 
void getNodeMassOptions (int nodeNumber, bool &loaded, bool &overrideMass)
 
bool isNodeWheelRim (int nodeNumber)
 
bool isNodeWheelTire (int nodeNumber)
 
int getWheelNodeCount ()
 
float getWheelSpeed ()
 
void reset (bool keep_position)
 
float getAirbrakeIntensity ()
 
int getAircraftFlaps ()
 
Physics editing
void scaleTruck (float ratio)
 
void setMass (float m)
 
void setLoadedMass (float loadMass)
 
void setNodeMass (int nodeNumber, float mass)
 
void setNodeMassOptions (int nodeNumber, bool loaded, bool overrideMass)
 
void setSimAttribute (ActorSimAttr attr, float val)
 
float getSimAttribute (ActorSimAttr attr)
 
void setIndexedSimAttribute (ActorSimAttr attr, float val, int index)
 
float getIndexedSimAttribute (ActorSimAttr attr, int index)
 
void recalculateNodeMasses ()
 
void setAirbrakeIntensity (float level)
 
void setAircraftFlaps (int level)
 
void wakeUp ()
 
void sendToSleep ()
 
User interaction
bool getParkingBrake ()
 
bool getTractionControl ()
 
bool getAntiLockBrake ()
 
bool getCruiseControl ()
 
void parkingbrakeToggle ()
 
void tractioncontrolToggle ()
 
void antilockbrakeToggle ()
 
void cruisecontrolToggle ()
 
void toggleCustomParticles ()
 
bool getCustomParticleMode ()
 
bool isLocked ()
 
void setForcedCinecam (int cinecamId, int flags)
 
void clearForcedCinecam ()
 
bool getForcedCinecam (int &inout, int &inout)
 
int getNumCinecams () const
 
int getCameraCount () const
 
int getCameraPosNode (int camIndex) const
 
int getCameraDirNode (int camIndex) const
 
int getCameraRollNode (int camIndex) const
 
Input engine overrides
float getEventValue (inputEvents eventID, bool pure=false, inputSourceType valueSource=inputSourceType::IST_ANY)
 
bool getEventBoolValue (inputEvents eventID)
 
bool getEventBoolValueBounce (inputEvents eventID, float time=0.2f)
 
void clearEventSimulatedValues ()
 
bool hasEventSimulatedValue (inputEvents eventID)
 
float getEventSimulatedValue (inputEvents eventID)
 
void setEventSimulatedValue (inputEvents eventID, float value)
 
void resetEventSimulatedValue (inputEvents eventID)
 
Subsystems
DashBoardManagerClass getDashboardManager ()
 
VehicleAIClass getVehicleAI ()
 
EngineClass getEngine ()
 
int getAircraftEngineCount ()
 
AircraftEngineClass getAircraftEngine (int index)
 
TurbojetClass getTurbojet (int index)
 
TurbopropClass getTurboprop (int index)
 
AutopilotClass getAutopilot ()
 
int getScrewpropCount ()
 
ScrewpropClass getScrewprop (int index)
 
Vehicle lights
int getBlinkType ()
 
void setBlinkType (int blink)
 
bool getCustomLightVisible (int number)
 
void setCustomLightVisible (int number, bool visible)
 
bool getBeaconMode ()
 
void beaconsToggle ()
 
bool getBrakeLightVisible ()
 
bool getReverseLightVisible ()
 
int countCustomLights (int)
 
int countFlaresByType (FlareType)
 
Organizational
string getTruckName ()
 
string getTruckFileName ()
 
string getTruckFileResourceGroup ()
 
string getSectionConfig ()
 
int getInstanceId ()
 

Member Function Documentation

◆ antilockbrakeToggle()

void Script2Game::BeamClass::antilockbrakeToggle ( )

Toggles the anti-lock brakes.

◆ beaconsToggle()

void Script2Game::BeamClass::beaconsToggle ( )

Toggles the beacons.

◆ clearEventSimulatedValues()

void Script2Game::BeamClass::clearEventSimulatedValues ( )

Removes all the event simulated values for the actor.

◆ clearForcedCinecam()

void Script2Game::BeamClass::clearForcedCinecam ( )

Resets the effect of setForcedCinecam();.

◆ countCustomLights()

int Script2Game::BeamClass::countCustomLights ( int  )

Counts flares using the given custom light group number (1-10).

◆ countFlaresByType()

int Script2Game::BeamClass::countFlaresByType ( FlareType  )

Counts flares using the given type.

◆ cruisecontrolToggle()

void Script2Game::BeamClass::cruisecontrolToggle ( )

Toggles the cruise control.

◆ getAirbrakeIntensity()

float Script2Game::BeamClass::getAirbrakeIntensity ( )
Returns
The air brake (speed brake) level for aircraft, from 0 (no braking) to 5 (maximum braking).

◆ getAircraftEngine()

AircraftEngineClass Script2Game::BeamClass::getAircraftEngine ( int  index)
Returns
The aircraft engine at the specified index, or null if the engine does not exist.

◆ getAircraftEngineCount()

int Script2Game::BeamClass::getAircraftEngineCount ( )
Returns
The amount of aircraft engines defined for this actor.

◆ getAircraftFlaps()

int Script2Game::BeamClass::getAircraftFlaps ( )
Returns
The flaps level for aircraft, from 0 (flaps up) to 5 (flaps fully down).

◆ getAntiLockBrake()

bool Script2Game::BeamClass::getAntiLockBrake ( )

Returns whether the anti-lock brake system (ABS) is enabled.

◆ getAutopilot()

AutopilotClass Script2Game::BeamClass::getAutopilot ( )

Retrieves the autopilot system object, or null if unavailable.

◆ getBeaconMode()

bool Script2Game::BeamClass::getBeaconMode ( )

Gets the mode of the beacon.

◆ getBlinkType()

int Script2Game::BeamClass::getBlinkType ( )

Gets the blinking type.

See also
blinktype

◆ getBrakeLightVisible()

bool Script2Game::BeamClass::getBrakeLightVisible ( )

Returns true if the brake light is enabled.

◆ getCameraCount()

int Script2Game::BeamClass::getCameraCount ( ) const

Reports number of installed cameras.

◆ getCameraDirNode()

int Script2Game::BeamClass::getCameraDirNode ( int  camIndex) const

Returns the direction node number for the camera at the specified index.

◆ getCameraPosNode()

int Script2Game::BeamClass::getCameraPosNode ( int  camIndex) const

Returns the position node number for the camera at the specified index.

◆ getCameraRollNode()

int Script2Game::BeamClass::getCameraRollNode ( int  camIndex) const

Returns the roll node number for the camera at the specified index.

◆ getCruiseControl()

bool Script2Game::BeamClass::getCruiseControl ( )

Returns whether cruise control is engaged.

◆ getCustomLightVisible()

bool Script2Game::BeamClass::getCustomLightVisible ( int  number)

Returns true if the custom light with the number number is enabled.

◆ getCustomParticleMode()

bool Script2Game::BeamClass::getCustomParticleMode ( )

Gets the custom particles mode.

◆ getDashboardManager()

DashBoardManagerClass Script2Game::BeamClass::getDashboardManager ( )

Retrieve dashboard manager.

◆ getDryMass()

float Script2Game::BeamClass::getDryMass ( )
Returns
The current dry mass of the truck, in kilograms.

◆ getEngine()

EngineClass Script2Game::BeamClass::getEngine ( )

Retrieve engine/transmission simulator.

◆ getEventBoolValue()

bool Script2Game::BeamClass::getEventBoolValue ( inputEvents  eventID)

Returns true if the given eventID is active, false otherwise.

If the eventID is simulated, returns true if the value is greater than 0.5.

◆ getEventBoolValueBounce()

bool Script2Game::BeamClass::getEventBoolValueBounce ( inputEvents  eventID,
float  time = 0.2f 
)

Returns true if the given input event is active and the bouncing on/off cycle is in 'on' state.

If the eventID is simulated, it behaves the same way as getEventBoolValue(), ignoring the time parameter.

◆ getEventSimulatedValue()

float Script2Game::BeamClass::getEventSimulatedValue ( inputEvents  eventID)

Returns the simulated value of the given input event for the actor, or 0 if the event value is not simulated.

◆ getEventValue()

float Script2Game::BeamClass::getEventValue ( inputEvents  eventID,
bool  pure = false,
inputSourceType  valueSource = inputSourceType::IST_ANY 
)

Returns the simulated value associated to the given eventID.

If eventID is not simulated, returns the same value as InputEngineClass.getEventValue().

Parameters
pureWhen true, the returned input value won't be adjusted for parameters such as deadzone or linearity on joysticks.
valueSourceIndicates the type of input device the event value should be retrieved from.

◆ getForcedCinecam()

bool Script2Game::BeamClass::getForcedCinecam ( int &  inout,
int &  inout 
)

Reports the values submitted by setForcedCinecam();.

Parameters
cinecamIdCinecams are numbered from 0, use getNumCinecams(); -1 means no cinecam.
flagsFlags are reserved for future use.
Returns
True if a forced camera was set, False if not.

◆ getGForces()

vector3 Script2Game::BeamClass::getGForces ( )

Gets the G-forces that this truck is currently experiencing.

Returns
a vector3 representing the G-forces

◆ getHeadingDirectionAngle()

float Script2Game::BeamClass::getHeadingDirectionAngle ( )

Returns the angle in which the truck is heading.

◆ getIndexedSimAttribute()

float Script2Game::BeamClass::getIndexedSimAttribute ( ActorSimAttr  attr,
int  index 
)

◆ getInitialDryMass()

float Script2Game::BeamClass::getInitialDryMass ( )
Returns
The initial dry mass of the truck, in kilograms

◆ getInitialLoadedMass()

float Script2Game::BeamClass::getInitialLoadedMass ( )
Returns
The initial load mass of the truck, in kilograms

◆ getInstanceId()

int Script2Game::BeamClass::getInstanceId ( )

Gets the unique Actor Instance ID; The same value as provided by Game2Script::eventCallbackEx().

◆ getLoadedMass()

float Script2Game::BeamClass::getLoadedMass ( )
Returns
The current load mass of the truck, in kilograms.

◆ getNodeCount()

int Script2Game::BeamClass::getNodeCount ( )

Gets the total amount of nodes of the truck.

◆ getNodeForces()

vector3 Script2Game::BeamClass::getNodeForces ( int  nodeNumber)

Returns the sum of all the forces applied to the node.

Parameters
nodeNumberThe number of the node (counts from 0, see getNodeCount())
Returns
The node's current force vector.

◆ getNodeInitialMass()

float Script2Game::BeamClass::getNodeInitialMass ( int  nodeNumber)

Returns the initial mass of the node.

Parameters
nodeNumberThe number of the node (counts from 0, see getNodeCount())
Returns
The node's initial mass, in kilograms

◆ getNodeMass()

float Script2Game::BeamClass::getNodeMass ( int  nodeNumber)

Returns the current mass of the node.

Parameters
nodeNumberThe number of the node (counts from 0, see getNodeCount())
Returns
The node's current mass, in kilograms

◆ getNodeMassOptions()

void Script2Game::BeamClass::getNodeMassOptions ( int  nodeNumber,
bool &  loaded,
bool &  overrideMass 
)

Returns the mass options of the node.

Parameters
nodeNumberThe number of the node (counts from 0, see getNodeCount())
loadedReference parameter. Indicates whether the node bears a part of the cargo load.
overrideMassReference parameter. Indicates whether the node mass can be overriden.
Returns
The node's mass options (using the reference parameters).

◆ getNodePosition()

vector3 Script2Game::BeamClass::getNodePosition ( int  nodeNumber)

Returns the position of the node.

Parameters
thenumber of the node (counts from 0, see getNodeCount())
Returns
vector3 of the world position for the node

◆ getNodeVelocity()

vector3 Script2Game::BeamClass::getNodeVelocity ( int  nodeNumber)

Returns the velocity vector of the node.

Parameters
nodeNumberThe number of the node (counts from 0, see getNodeCount())
Returns
The node's current velocity vector

◆ getNumCinecams()

int Script2Game::BeamClass::getNumCinecams ( ) const

Reports number of installed cinecams.

◆ getOrientation()

quaternion Script2Game::BeamClass::getOrientation ( )

Orientation on all axes packed to single quaternion.

Use getYaw(), getPitch() and getRoll() for individual rotations in radians.

◆ getParkingBrake()

bool Script2Game::BeamClass::getParkingBrake ( )

Returns whether the parking brake is engaged.

◆ getPosition()

vector3 Script2Game::BeamClass::getPosition ( )

Get vehicle absolute position.

◆ getReverseLightVisible()

bool Script2Game::BeamClass::getReverseLightVisible ( )

Returns true if the reverse lights are enabled.

◆ getRotation()

float Script2Game::BeamClass::getRotation ( )

Returns the angle in which the truck is heading.

◆ getScrewprop()

ScrewpropClass Script2Game::BeamClass::getScrewprop ( int  index)
Returns
The screwprop at the specified index, or null if the screwprop doesn't exist.

◆ getScrewpropCount()

int Script2Game::BeamClass::getScrewpropCount ( )
Returns
The amount of screwprops defined for this actor.

◆ getSectionConfig()

string Script2Game::BeamClass::getSectionConfig ( )

Gets the name of the loaded section for a truck.

◆ getSimAttribute()

float Script2Game::BeamClass::getSimAttribute ( ActorSimAttr  attr)

◆ getSpeed()

float Script2Game::BeamClass::getSpeed ( )

Returns the current physical speed of the vehicle, in meters per second.

◆ getTotalMass()

float Script2Game::BeamClass::getTotalMass ( bool  withLocked)

Gets the total mass of the truck.

Parameters
withLockedif true, the mass of everything locked to the truck will be added to the mass of the truck.

◆ getTractionControl()

bool Script2Game::BeamClass::getTractionControl ( )

Returns whether traction control is enabled.

◆ getTruckFileName()

string Script2Game::BeamClass::getTruckFileName ( )

Gets the name of the truck definition file.

◆ getTruckFileResourceGroup()

string Script2Game::BeamClass::getTruckFileResourceGroup ( )

Gets the name of the OGRE resource group where the truck definition file lives.

Useful for loading using GenericDocumentClass.

◆ getTruckName()

string Script2Game::BeamClass::getTruckName ( )

Gets the designated name of the truck.

◆ getTruckState()

TruckState Script2Game::BeamClass::getTruckState ( )

◆ getTurbojet()

TurbojetClass Script2Game::BeamClass::getTurbojet ( int  index)
Returns
The turbojet engine at the specified index, or null if the engine is not a turbojet or doesn't exist.

◆ getTurboprop()

TurbopropClass Script2Game::BeamClass::getTurboprop ( int  index)
Returns
The propeller engine at the specified index, or null if the engine is not a propeller or doesn't exist.

◆ getVehicleAI()

VehicleAIClass Script2Game::BeamClass::getVehicleAI ( )

Retrieve the waypoint AI object.

◆ getVehiclePosition()

vector3 Script2Game::BeamClass::getVehiclePosition ( )

◆ getWheelNodeCount()

int Script2Game::BeamClass::getWheelNodeCount ( )

Gets the total amount of nodes of the wheels of the truck.

◆ getWheelSpeed()

float Script2Game::BeamClass::getWheelSpeed ( )

Gets the current wheel speed of the vehicle.

◆ hasEventSimulatedValue()

bool Script2Game::BeamClass::hasEventSimulatedValue ( inputEvents  eventID)

Returns true if the actor simulates the given input event.

◆ isLocked()

bool Script2Game::BeamClass::isLocked ( )

Returns true if a hook of this truck is locked.

◆ isNodeWheelRim()

bool Script2Game::BeamClass::isNodeWheelRim ( int  nodeNumber)

Is node marked as wheel rim? Note some wheel models use only tire nodes.

See https://docs.rigsofrods.org/vehicle-creation/fileformat-truck/#wheels

Parameters
thenumber of the node (counts from 0, see getNodeCount())
Returns
True if the node is a wheel rim.

◆ isNodeWheelTire()

bool Script2Game::BeamClass::isNodeWheelTire ( int  nodeNumber)

Is node marked as wheel tire? Note some wheel models use only tire nodes.

See https://docs.rigsofrods.org/vehicle-creation/fileformat-truck/#wheels

Parameters
thenumber of the node (counts from 0, see getNodeCount())
Returns
True if this is a tire node.

◆ parkingbrakeToggle()

void Script2Game::BeamClass::parkingbrakeToggle ( )

Toggles the parking brake.

◆ recalculateNodeMasses()

void Script2Game::BeamClass::recalculateNodeMasses ( )

Recalculates the masses of all the nodes.

Warning
Do not call this function repeatedly! Otherwise, performance might be degraded.

◆ reset()

void Script2Game::BeamClass::reset ( bool  keep_position)

Resets the truck.

Parameters
reset_positiontrue if you want to keep the truck at the current position. (otherwise, it will be moved to its origin position)

◆ resetEventSimulatedValue()

void Script2Game::BeamClass::resetEventSimulatedValue ( inputEvents  eventID)

Resets the simulated value for the given input event.

◆ scaleTruck()

void Script2Game::BeamClass::scaleTruck ( float  ratio)

Scales the truck.

◆ sendToSleep()

void Script2Game::BeamClass::sendToSleep ( )

◆ setAirbrakeIntensity()

void Script2Game::BeamClass::setAirbrakeIntensity ( float  level)

Sets the air braking level for aircraft, from 0 (no braking) to 5 (maximum braking).

◆ setAircraftFlaps()

void Script2Game::BeamClass::setAircraftFlaps ( int  level)

Sets the flaps level for aircraft, from 0 (flaps up) to 5 (flaps fully down).

◆ setBlinkType()

void Script2Game::BeamClass::setBlinkType ( int  blink)

Sets the blinking type.

See also
blinktype

◆ setCustomLightVisible()

void Script2Game::BeamClass::setCustomLightVisible ( int  number,
bool  visible 
)

Enables or disables the custom light.

◆ setEventSimulatedValue()

void Script2Game::BeamClass::setEventSimulatedValue ( inputEvents  eventID,
float  value 
)

Sets a float value that simulates the state of the given input event, exclusively for this actor.

As soon as an event is associated to a simulated value, functions like getEventValue() will ignore the values returned by the input engine and return the simulated value instead.

If you want to stop simulating the event value, call resetEventSimulatedValue().

◆ setForcedCinecam()

void Script2Game::BeamClass::setForcedCinecam ( int  cinecamId,
int  flags 
)

Sets a forced cinecam for this actor; This disables camera hotkeys.

Parameters
cinecamIdCinecams are numbered from 0, use getNumCinecams(); -1 means no cinecam.
flagsFlags are reserved for future use.

◆ setIndexedSimAttribute()

void Script2Game::BeamClass::setIndexedSimAttribute ( ActorSimAttr  attr,
float  val,
int  index 
)

Allows advanced users to set physics settings directly, including some not accessible from rig-def file format.

HAZARDOUS - values may not be checked; Pay attention to 'safe values' at each attribute description.

◆ setLoadedMass()

void Script2Game::BeamClass::setLoadedMass ( float  loadMass)

Sets the load mass of the truck.

Note
Use recalculateNodeMasses() to make your changes effective.

◆ setMass()

void Script2Game::BeamClass::setMass ( float  m)

Sets the dry mass of the truck.

Note
Use recalculateNodeMasses() to make your changes effective.

◆ setNodeMass()

void Script2Game::BeamClass::setNodeMass ( int  nodeNumber,
float  mass 
)

Overrides the node's mass.

Note
If the node bears a part of the load mass (is marked with the l option) and its mass can't be overriden, this function has no effect.
Use recalculateNodeMasses() to make your changes effective.
Warning
This function might break the N/B if you set the wrong mass. Always set masses adequate to the truck you're working on!

◆ setNodeMassOptions()

void Script2Game::BeamClass::setNodeMassOptions ( int  nodeNumber,
bool  loaded,
bool  overrideMass 
)

Sets the mass options of the node.

Parameters
nodeNumberThe number of the node (counts from 0, see getNodeCount())
loadedAllows the node to bear a part of the cargo load.
overrideMassAllows the node mass to be overriden.
Note
Use recalculateNodeMasses() to make your changes effective.

◆ setSimAttribute()

void Script2Game::BeamClass::setSimAttribute ( ActorSimAttr  attr,
float  val 
)

Allows advanced users to set physics settings directly, including some not accessible from rig-def file format.

HAZARDOUS - values may not be checked; Pay attention to 'safe values' at each attribute description.

◆ toggleCustomParticles()

void Script2Game::BeamClass::toggleCustomParticles ( )

Toggles the custom particles.

◆ tractioncontrolToggle()

void Script2Game::BeamClass::tractioncontrolToggle ( )

Toggles the traction control.

◆ wakeUp()

void Script2Game::BeamClass::wakeUp ( )

The documentation for this class was generated from the following file: