RigsofRods
Soft-body Physics Simulation
Public Member Functions | Static Public Member Functions | Data Fields | Private Member Functions | Private Attributes
RoR::SlideNode Class Reference

#include <SlideNode.h>

+ Collaboration diagram for RoR::SlideNode:

Public Member Functions

 SlideNode (node_t *sliding_node, RailGroup *rail)
 
int GetSlideNodeId ()
 Returns the node index of the slide node. More...
 
void UpdateForces (float dt)
 Updates the corrective forces and applies these forces to the beam. More...
 
void UpdatePosition ()
 Checks for current rail segment and updates ideal position of the node. More...
 
void SetDefaultRail (RailGroup *rail)
 Sets rail to initially use when spawned or reset. More...
 
void ResetPositions ()
 Recalculates the closest position on current RailGroup. More...
 
void ResetSlideNode ()
 Move back to initial rail, reset 'broken' flag and recalculate closest position. More...
 
const Ogre::Vector3 & GetSlideNodePosition () const
 
void AttachToRail (RailGroup *toAttach)
 
Ogre::Real getLenTo (const RailGroup *group) const
 
Ogre::Real getLenTo (const RailSegment *rail) const
 
Ogre::Real getLenTo (const beam_t *beam) const
 

Static Public Member Functions

static Ogre::Real getLenTo (const RailGroup *group, const Ogre::Vector3 &point)
 
static Ogre::Real getLenTo (const RailSegment *rail, const Ogre::Vector3 &point)
 
static Ogre::Real getLenTo (const beam_t *beam, const Ogre::Vector3 &point)
 

Data Fields

bool sn_attach_self:1
 Attach/detach to rails on the current vehicle only. More...
 
bool sn_attach_foreign:1
 Attach/detach to rails only on other vehicles. More...
 
bool sn_slide_broken:1
 The slidenode was pulled away from the rail. More...
 

Private Member Functions

Ogre::Vector3 CalcCorrectiveForces ()
 Calculate forces between the ideal and actual position of the sliding node. More...
 

Private Attributes

node_tm_sliding_node
 Pointer to node that is sliding. More...
 
beam_tm_sliding_beam
 Pointer to current beam sliding on. More...
 
RailGroupm_initial_railgroup
 Initial Rail group on spawn. More...
 
RailGroupm_cur_railgroup
 Current Rail group, used for attachments. More...
 
RailSegmentm_cur_rail_seg
 Current rail segment we are sliding on. More...
 
float m_node_forces_ratio
 Ratio of length along the slide beam where the virtual node is "0.0f = p1, 1.0f = p2". More...
 
Ogre::Vector3 m_ideal_position
 Where the node SHOULD be. (World, m) More...
 
float m_initial_threshold
 Distance from beam calculating corrective forces (m) More...
 
float m_cur_threshold
 Distance away from beam before corrective forces begin to act on the node (m) More...
 
float m_spring_rate
 Spring rate holding node to rail (N/m) More...
 
float m_break_force
 Force at which Slide Node breaks away from the rail (N) More...
 
float m_attach_rate
 How fast the cur threshold changes when attaching (i.e. how long it will take for springs to fully attach to the Rail) (m/s) More...
 
float m_attach_distance
 Maximum distance slide node will attach to a beam (m) More...
 

Detailed Description

Definition at line 64 of file SlideNode.h.

Constructor & Destructor Documentation

◆ SlideNode()

SlideNode::SlideNode ( node_t sliding_node,
RailGroup rail 
)
Parameters
sliding_nodevalid pointer to the node acting as a slide node
railinitial RailGroup to slide on, or NULL.

Definition at line 63 of file SlideNode.cpp.

Member Function Documentation

◆ AttachToRail()

void RoR::SlideNode::AttachToRail ( RailGroup toAttach)
inline
Parameters
toAttachWhich rail to attach to, Pass NULL to detach this SlideNode from any rail.

Definition at line 140 of file SlideNode.h.

+ Here is the call graph for this function:

◆ CalcCorrectiveForces()

Ogre::Vector3 SlideNode::CalcCorrectiveForces ( )
private

Calculate forces between the ideal and actual position of the sliding node.

Definition at line 249 of file SlideNode.cpp.

+ Here is the caller graph for this function:

◆ getLenTo() [1/6]

Ogre::Real SlideNode::getLenTo ( const beam_t beam) const
Parameters
beam
Returns
value is always positive, if beam is null return infinity

Definition at line 244 of file SlideNode.cpp.

+ Here is the call graph for this function:

◆ getLenTo() [2/6]

Ogre::Real SlideNode::getLenTo ( const beam_t beam,
const Ogre::Vector3 &  point 
)
static
Parameters
beam
point
Returns
value is always positive, if beam is null return infinity

Definition at line 226 of file SlideNode.cpp.

+ Here is the call graph for this function:

◆ getLenTo() [3/6]

Ogre::Real SlideNode::getLenTo ( const RailGroup group) const
Parameters
group
Returns
value is always positive, if group is null return infinity.

Definition at line 234 of file SlideNode.cpp.

+ Here is the call graph for this function:

◆ getLenTo() [4/6]

Ogre::Real SlideNode::getLenTo ( const RailGroup group,
const Ogre::Vector3 &  point 
)
static
Parameters
group
point
Returns
value is always positive, if group is null return infinity.

Definition at line 210 of file SlideNode.cpp.

+ Here is the caller graph for this function:

◆ getLenTo() [5/6]

Ogre::Real SlideNode::getLenTo ( const RailSegment rail) const
Parameters
rail
Returns
value is always positive, if rail is null return infinity.

Definition at line 239 of file SlideNode.cpp.

+ Here is the call graph for this function:

◆ getLenTo() [6/6]

Ogre::Real SlideNode::getLenTo ( const RailSegment rail,
const Ogre::Vector3 &  point 
)
static
Parameters
rail
point
Returns
value is always positive, if rail is null return infinity.

Definition at line 218 of file SlideNode.cpp.

+ Here is the call graph for this function:

◆ GetSlideNodeId()

int SlideNode::GetSlideNodeId ( )

Returns the node index of the slide node.

Definition at line 159 of file SlideNode.cpp.

◆ GetSlideNodePosition()

const Ogre::Vector3 & SlideNode::GetSlideNodePosition ( ) const
Returns
The current position of the SlideNode

Definition at line 195 of file SlideNode.cpp.

+ Here is the caller graph for this function:

◆ ResetPositions()

void SlideNode::ResetPositions ( )

Recalculates the closest position on current RailGroup.

Definition at line 200 of file SlideNode.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ResetSlideNode()

void RoR::SlideNode::ResetSlideNode ( )
inline

Move back to initial rail, reset 'broken' flag and recalculate closest position.

Definition at line 92 of file SlideNode.h.

+ Here is the call graph for this function:

◆ SetDefaultRail()

void RoR::SlideNode::SetDefaultRail ( RailGroup rail)
inline

Sets rail to initially use when spawned or reset.

Definition at line 82 of file SlideNode.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UpdateForces()

void SlideNode::UpdateForces ( float  dt)

Updates the corrective forces and applies these forces to the beam.

Parameters
dtdelta time in seconds

Definition at line 87 of file SlideNode.cpp.

+ Here is the call graph for this function:

◆ UpdatePosition()

void SlideNode::UpdatePosition ( )

Checks for current rail segment and updates ideal position of the node.

Definition at line 164 of file SlideNode.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ m_attach_distance

float RoR::SlideNode::m_attach_distance
private

Maximum distance slide node will attach to a beam (m)

Definition at line 126 of file SlideNode.h.

◆ m_attach_rate

float RoR::SlideNode::m_attach_rate
private

How fast the cur threshold changes when attaching (i.e. how long it will take for springs to fully attach to the Rail) (m/s)

Definition at line 125 of file SlideNode.h.

◆ m_break_force

float RoR::SlideNode::m_break_force
private

Force at which Slide Node breaks away from the rail (N)

Definition at line 124 of file SlideNode.h.

◆ m_cur_rail_seg

RailSegment* RoR::SlideNode::m_cur_rail_seg
private

Current rail segment we are sliding on.

Definition at line 118 of file SlideNode.h.

◆ m_cur_railgroup

RailGroup* RoR::SlideNode::m_cur_railgroup
private

Current Rail group, used for attachments.

Definition at line 117 of file SlideNode.h.

◆ m_cur_threshold

float RoR::SlideNode::m_cur_threshold
private

Distance away from beam before corrective forces begin to act on the node (m)

Definition at line 122 of file SlideNode.h.

◆ m_ideal_position

Ogre::Vector3 RoR::SlideNode::m_ideal_position
private

Where the node SHOULD be. (World, m)

Definition at line 120 of file SlideNode.h.

◆ m_initial_railgroup

RailGroup* RoR::SlideNode::m_initial_railgroup
private

Initial Rail group on spawn.

Definition at line 116 of file SlideNode.h.

◆ m_initial_threshold

float RoR::SlideNode::m_initial_threshold
private

Distance from beam calculating corrective forces (m)

Definition at line 121 of file SlideNode.h.

◆ m_node_forces_ratio

float RoR::SlideNode::m_node_forces_ratio
private

Ratio of length along the slide beam where the virtual node is "0.0f = p1, 1.0f = p2".

Definition at line 119 of file SlideNode.h.

◆ m_sliding_beam

beam_t* RoR::SlideNode::m_sliding_beam
private

Pointer to current beam sliding on.

Definition at line 115 of file SlideNode.h.

◆ m_sliding_node

node_t* RoR::SlideNode::m_sliding_node
private

Pointer to node that is sliding.

Definition at line 114 of file SlideNode.h.

◆ m_spring_rate

float RoR::SlideNode::m_spring_rate
private

Spring rate holding node to rail (N/m)

Definition at line 123 of file SlideNode.h.

◆ sn_attach_foreign

bool RoR::SlideNode::sn_attach_foreign

Attach/detach to rails only on other vehicles.

Definition at line 107 of file SlideNode.h.

◆ sn_attach_self

bool RoR::SlideNode::sn_attach_self

Attach/detach to rails on the current vehicle only.

Definition at line 106 of file SlideNode.h.

◆ sn_slide_broken

bool RoR::SlideNode::sn_slide_broken

The slidenode was pulled away from the rail.

Definition at line 108 of file SlideNode.h.


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