RigsofRods
Soft-body Physics Simulation
Modules | Data Structures | Enumerations | Variables
Physics

Soft-body physics and associated simulations. More...

+ Collaboration diagram for Physics:

Modules

 Collisions
 Static & dynamic collision detection system.
 

Data Structures

class  RoR::Actor
 Softbody object; can be anything from soda can to a space shuttle Constructed from a truck definition file, see https://docs.rigsofrods.org/vehicle-creation/fileformat-truck/ To spawn in-game, use MSG_SIM_SPAWN_ACTOR_REQUESTED, see GameContext::PushMessage(), in AngelScript use game.pushMessage(); Gameplay states are described by enum ActorState. More...
 
class  RoR::ActorManager
 Builds and manages softbody actors (physics on background thread, networking) More...
 
class  RoR::ActorSpawner
 Processes a RigDef::Document (parsed from 'truck' file format) into a simulated gameplay object (Actor). More...
 
class  RoR::Airfoil
 Represents an airfoil http://en.wikipedia.org/wiki/Airfoil. More...
 
class  RoR::FlexAirfoil
 
struct  RoR::node_t
 Physics: A vertex in the softbody structure. More...
 
struct  RoR::beam_t
 Simulation: An edge in the softbody structure. More...
 
struct  RoR::shock_t
 
struct  RoR::collcab_rate_t
 
struct  RoR::FreeForce
 Global force affecting particular (base) node of particular (base) actor; added ad-hoc by scripts. More...
 
struct  RoR::FreeForceRequest
 Common for ADD and MODIFY requests; tailored for use with AngelScript thru GameScript::pushMessage(). More...
 
struct  RoR::RailSegment
 A single beam in a chain. More...
 
struct  RoR::RailGroup
 A series of RailSegment-s for SlideNode to slide along. Can be closed in a loop. More...
 
class  RoR::SlideNode
 
class  RoR::Buoyance
 

Enumerations

enum  RoR::BeamType : short { RoR::BEAM_NORMAL, RoR::BEAM_HYDRO, RoR::BEAM_VIRTUAL }
 
enum  RoR::SpecialBeam : short {
  RoR::NOSHOCK, RoR::SHOCK1, RoR::SHOCK2, RoR::SHOCK3,
  RoR::TRIGGER, RoR::SUPPORTBEAM, RoR::ROPE
}
 
enum  RoR::ShockFlags {
  RoR::SHOCK_FLAG_NORMAL = BITMASK(1), RoR::SHOCK_FLAG_LACTIVE = BITMASK(3), RoR::SHOCK_FLAG_RACTIVE = BITMASK(4), RoR::SHOCK_FLAG_ISSHOCK2 = BITMASK(5),
  RoR::SHOCK_FLAG_ISSHOCK3 = BITMASK(6), RoR::SHOCK_FLAG_SOFTBUMP = BITMASK(7), RoR::SHOCK_FLAG_ISTRIGGER = BITMASK(8), RoR::SHOCK_FLAG_TRG_BLOCKER = BITMASK(9),
  RoR::SHOCK_FLAG_TRG_CMD_SWITCH = BITMASK(10), RoR::SHOCK_FLAG_TRG_CMD_BLOCKER = BITMASK(11), RoR::SHOCK_FLAG_TRG_BLOCKER_A = BITMASK(12), RoR::SHOCK_FLAG_TRG_HOOK_UNLOCK = BITMASK(13),
  RoR::SHOCK_FLAG_TRG_HOOK_LOCK = BITMASK(14), RoR::SHOCK_FLAG_TRG_CONTINUOUS = BITMASK(15), RoR::SHOCK_FLAG_TRG_ENGINE = BITMASK(16)
}
 
enum  RoR::ActorState {
  RoR::ActorState::LOCAL_SIMULATED, RoR::ActorState::NETWORKED_OK, RoR::ActorState::NETWORKED_HIDDEN, RoR::ActorState::LOCAL_REPLAY,
  RoR::ActorState::LOCAL_SLEEPING, RoR::ActorState::DISPOSED
}
 
enum  RoR::AeroEngineType { RoR::AeroEngineType::AE_UNKNOWN, RoR::AeroEngineType::AE_XPROP, RoR::AeroEngineType::AE_TURBOJET }
 
enum  RoR::FreeForceType { RoR::FreeForceType::DUMMY, RoR::FreeForceType::CONSTANT, RoR::FreeForceType::TOWARDS_COORDS, RoR::FreeForceType::TOWARDS_NODE }
 

Variables

static const float DEFAULT_RIGIDIFIER_SPRING = 1000000.0f
 
static const float DEFAULT_RIGIDIFIER_DAMP = 50000.0f
 
static const float DEFAULT_SPRING = 9000000.0f
 
static const float DEFAULT_DAMP = 12000.0f
 
static const float DEFAULT_GRAVITY = -9.807f
 earth gravity More...
 
static const float DEFAULT_DRAG = 0.05f
 
static const float DEFAULT_BEAM_DIAMETER = 0.05f
 5 centimeters default beam width More...
 
static const float DEFAULT_COLLISION_RANGE = 0.02f
 
static const float DEFAULT_MINIMASS = 50.0f
 minimum node mass in Kg More...
 
static const float MIN_BEAM_LENGTH = 0.1f
 minimum beam lenght is 10 centimeters More...
 
static const float INVERTED_MIN_BEAM_LENGTH = 1.0f / MIN_BEAM_LENGTH
 
static const float BEAM_SKELETON_DIAMETER = 0.01f
 
static const float DEFAULT_WATERDRAG = 10.0f
 
static const float IRON_DENSITY = 7874.0f
 
static const float BEAM_BREAK = 1000000.0f
 
static const float BEAM_DEFORM = 400000.0f
 
static const float BEAM_CREAK_DEFAULT = 100000.0f
 
static const float WHEEL_FRICTION_COEF = 2.0f
 
static const float CHASSIS_FRICTION_COEF = 0.5f
 Chassis has 1/4 the friction of wheels. More...
 
static const float SPEED_STOP = 0.2f
 
static const float STAB_RATE = 0.025f
 
static const float NODE_FRICTION_COEF_DEFAULT = 1.0f
 
static const float NODE_VOLUME_COEF_DEFAULT = 1.0f
 
static const float NODE_SURFACE_COEF_DEFAULT = 1.0f
 
static const float NODE_LOADWEIGHT_DEFAULT = -1.0f
 
static const float SUPPORT_BEAM_LIMIT_DEFAULT = 4.0f
 
static const float ROTATOR_FORCE_DEFAULT = 10000000.0f
 
static const float ROTATOR_TOLERANCE_DEFAULT = 0.0f
 
static const float HOOK_FORCE_DEFAULT = 10000000.0f
 
static const float HOOK_RANGE_DEFAULT = 0.4f
 
static const float HOOK_SPEED_DEFAULT = 0.00025f
 
static const float HOOK_LOCK_TIMER_DEFAULT = 5.0
 
static const int NODE_LOCKGROUP_DEFAULT = -1
 
static const int DEFAULT_DETACHER_GROUP = 0
 
static const float DEFAULT_SPEEDO_MAX_KPH = 140.f
 
static const float FLAP_ANGLES [6] = {0.f, -0.07f, -0.17f, -0.33f, -0.67f, -1.f}
 

Detailed Description

Soft-body physics and associated simulations.

Enumeration Type Documentation

◆ ActorState

enum RoR::ActorState
strong
Enumerator
LOCAL_SIMULATED 

simulated (local) actor

NETWORKED_OK 

not simulated (remote) actor

NETWORKED_HIDDEN 

not simulated, not updated (remote)

LOCAL_REPLAY 
LOCAL_SLEEPING 

sleeping (local) actor

DISPOSED 

removed from simulation, still in memory to satisfy pointers.

Definition at line 265 of file SimData.h.

◆ AeroEngineType

enum RoR::AeroEngineType
strong
Enumerator
AE_UNKNOWN 
AE_XPROP 
AE_TURBOJET 

Definition at line 275 of file SimData.h.

◆ BeamType

enum RoR::BeamType : short
Enumerator
BEAM_NORMAL 
BEAM_HYDRO 
BEAM_VIRTUAL 

Excluded from mass calculations, visuals permanently disabled.

Definition at line 69 of file SimData.h.

◆ FreeForceType

enum RoR::FreeForceType
strong
Enumerator
DUMMY 

No force.

CONSTANT 

Constant force given by direction and magnitude.

TOWARDS_COORDS 

Constant force directed towards ffc_target_coords

TOWARDS_NODE 

Constant force directed towards ffc_target_node

Definition at line 779 of file SimData.h.

◆ ShockFlags

Enumerator
SHOCK_FLAG_NORMAL 
SHOCK_FLAG_LACTIVE 
SHOCK_FLAG_RACTIVE 
SHOCK_FLAG_ISSHOCK2 
SHOCK_FLAG_ISSHOCK3 
SHOCK_FLAG_SOFTBUMP 
SHOCK_FLAG_ISTRIGGER 
SHOCK_FLAG_TRG_BLOCKER 
SHOCK_FLAG_TRG_CMD_SWITCH 
SHOCK_FLAG_TRG_CMD_BLOCKER 
SHOCK_FLAG_TRG_BLOCKER_A 
SHOCK_FLAG_TRG_HOOK_UNLOCK 
SHOCK_FLAG_TRG_HOOK_LOCK 
SHOCK_FLAG_TRG_CONTINUOUS 
SHOCK_FLAG_TRG_ENGINE 

Definition at line 195 of file SimData.h.

◆ SpecialBeam

enum RoR::SpecialBeam : short
Enumerator
NOSHOCK 

not a shock

SHOCK1 

shock1

SHOCK2 

shock2

SHOCK3 

shock3

TRIGGER 

trigger

SUPPORTBEAM 
ROPE 

Definition at line 105 of file SimData.h.

Variable Documentation

◆ BEAM_BREAK

const float BEAM_BREAK = 1000000.0f
static

Definition at line 60 of file SimConstants.h.

◆ BEAM_CREAK_DEFAULT

const float BEAM_CREAK_DEFAULT = 100000.0f
static

Definition at line 62 of file SimConstants.h.

◆ BEAM_DEFORM

const float BEAM_DEFORM = 400000.0f
static

Definition at line 61 of file SimConstants.h.

◆ BEAM_SKELETON_DIAMETER

const float BEAM_SKELETON_DIAMETER = 0.01f
static

Definition at line 57 of file SimConstants.h.

◆ CHASSIS_FRICTION_COEF

const float CHASSIS_FRICTION_COEF = 0.5f
static

Chassis has 1/4 the friction of wheels.

Definition at line 64 of file SimConstants.h.

◆ DEFAULT_BEAM_DIAMETER

const float DEFAULT_BEAM_DIAMETER = 0.05f
static

5 centimeters default beam width

Definition at line 52 of file SimConstants.h.

◆ DEFAULT_COLLISION_RANGE

const float DEFAULT_COLLISION_RANGE = 0.02f
static

Definition at line 53 of file SimConstants.h.

◆ DEFAULT_DAMP

const float DEFAULT_DAMP = 12000.0f
static

Definition at line 49 of file SimConstants.h.

◆ DEFAULT_DETACHER_GROUP

const int DEFAULT_DETACHER_GROUP = 0
static

Definition at line 79 of file SimConstants.h.

◆ DEFAULT_DRAG

const float DEFAULT_DRAG = 0.05f
static

Definition at line 51 of file SimConstants.h.

◆ DEFAULT_GRAVITY

const float DEFAULT_GRAVITY = -9.807f
static

earth gravity

Definition at line 50 of file SimConstants.h.

◆ DEFAULT_MINIMASS

const float DEFAULT_MINIMASS = 50.0f
static

minimum node mass in Kg

Definition at line 54 of file SimConstants.h.

◆ DEFAULT_RIGIDIFIER_DAMP

const float DEFAULT_RIGIDIFIER_DAMP = 50000.0f
static

Definition at line 47 of file SimConstants.h.

◆ DEFAULT_RIGIDIFIER_SPRING

const float DEFAULT_RIGIDIFIER_SPRING = 1000000.0f
static

Definition at line 46 of file SimConstants.h.

◆ DEFAULT_SPEEDO_MAX_KPH

const float DEFAULT_SPEEDO_MAX_KPH = 140.f
static

Definition at line 80 of file SimConstants.h.

◆ DEFAULT_SPRING

const float DEFAULT_SPRING = 9000000.0f
static

Definition at line 48 of file SimConstants.h.

◆ DEFAULT_WATERDRAG

const float DEFAULT_WATERDRAG = 10.0f
static

Definition at line 58 of file SimConstants.h.

◆ FLAP_ANGLES

const float FLAP_ANGLES[6] = {0.f, -0.07f, -0.17f, -0.33f, -0.67f, -1.f}
static

Definition at line 82 of file SimConstants.h.

◆ HOOK_FORCE_DEFAULT

const float HOOK_FORCE_DEFAULT = 10000000.0f
static

Definition at line 74 of file SimConstants.h.

◆ HOOK_LOCK_TIMER_DEFAULT

const float HOOK_LOCK_TIMER_DEFAULT = 5.0
static

Definition at line 77 of file SimConstants.h.

◆ HOOK_RANGE_DEFAULT

const float HOOK_RANGE_DEFAULT = 0.4f
static

Definition at line 75 of file SimConstants.h.

◆ HOOK_SPEED_DEFAULT

const float HOOK_SPEED_DEFAULT = 0.00025f
static

Definition at line 76 of file SimConstants.h.

◆ INVERTED_MIN_BEAM_LENGTH

const float INVERTED_MIN_BEAM_LENGTH = 1.0f / MIN_BEAM_LENGTH
static

Definition at line 56 of file SimConstants.h.

◆ IRON_DENSITY

const float IRON_DENSITY = 7874.0f
static

Definition at line 59 of file SimConstants.h.

◆ MIN_BEAM_LENGTH

const float MIN_BEAM_LENGTH = 0.1f
static

minimum beam lenght is 10 centimeters

Definition at line 55 of file SimConstants.h.

◆ NODE_FRICTION_COEF_DEFAULT

const float NODE_FRICTION_COEF_DEFAULT = 1.0f
static

Definition at line 67 of file SimConstants.h.

◆ NODE_LOADWEIGHT_DEFAULT

const float NODE_LOADWEIGHT_DEFAULT = -1.0f
static

Definition at line 70 of file SimConstants.h.

◆ NODE_LOCKGROUP_DEFAULT

const int NODE_LOCKGROUP_DEFAULT = -1
static

Definition at line 78 of file SimConstants.h.

◆ NODE_SURFACE_COEF_DEFAULT

const float NODE_SURFACE_COEF_DEFAULT = 1.0f
static

Definition at line 69 of file SimConstants.h.

◆ NODE_VOLUME_COEF_DEFAULT

const float NODE_VOLUME_COEF_DEFAULT = 1.0f
static

Definition at line 68 of file SimConstants.h.

◆ ROTATOR_FORCE_DEFAULT

const float ROTATOR_FORCE_DEFAULT = 10000000.0f
static

Definition at line 72 of file SimConstants.h.

◆ ROTATOR_TOLERANCE_DEFAULT

const float ROTATOR_TOLERANCE_DEFAULT = 0.0f
static

Definition at line 73 of file SimConstants.h.

◆ SPEED_STOP

const float SPEED_STOP = 0.2f
static

Definition at line 65 of file SimConstants.h.

◆ STAB_RATE

const float STAB_RATE = 0.025f
static

Definition at line 66 of file SimConstants.h.

◆ SUPPORT_BEAM_LIMIT_DEFAULT

const float SUPPORT_BEAM_LIMIT_DEFAULT = 4.0f
static

Definition at line 71 of file SimConstants.h.

◆ WHEEL_FRICTION_COEF

const float WHEEL_FRICTION_COEF = 2.0f
static

Definition at line 63 of file SimConstants.h.