31#include <OgreVector3.h>
152 static Ogre::Real
getLenTo(
const RailGroup* group,
const Ogre::Vector3& point );
166 static Ogre::Real
getLenTo(
const beam_t* beam,
const Ogre::Vector3& point );
Global forward declarations.
void UpdateForces(float dt)
Updates the corrective forces and applies these forces to the beam.
void SetAttachmentRate(float rate)
How long it will take for springs to fully attach to the Rail.
int GetSlideNodeId()
Returns the node index of the slide node.
void ResetPositions()
Recalculates the closest position on current RailGroup.
RailGroup * m_cur_railgroup
Current Rail group, used for attachments.
float m_attach_rate
How fast the cur threshold changes when attaching (i.e. how long it will take for springs to fully at...
void SetBreakForce(float breakRate)
Force required to break the Node from the Rail.
void SetCorThreshold(float threshold)
Distance from a beam before corrective forces take effect.
Ogre::Vector3 m_ideal_position
Where the node SHOULD be. (World, m)
void UpdatePosition()
Checks for current rail segment and updates ideal position of the node.
void SetDefaultRail(RailGroup *rail)
Sets rail to initially use when spawned or reset.
void SetSpringRate(float rate)
Spring force used to calculate corrective forces.
float GetAttachmentDistance() const
Maximum distance this spring node is allowed to reach out for a Rail.
bool sn_attach_self
Attach/detach to rails on the current vehicle only.
void SetAttachmentDistance(float dist)
Maximum distance this spring node is allowed to reach out for a Rail.
float m_initial_threshold
Distance from beam calculating corrective forces (m)
float m_spring_rate
Spring rate holding node to rail (N/m)
bool sn_slide_broken
The slidenode was pulled away from the rail.
float m_cur_threshold
Distance away from beam before corrective forces begin to act on the node (m)
float m_attach_distance
Maximum distance slide node will attach to a beam (m)
Ogre::Vector3 CalcCorrectiveForces()
Calculate forces between the ideal and actual position of the sliding node.
node_t * m_sliding_node
Pointer to node that is sliding.
void AttachToRail(RailGroup *toAttach)
beam_t * m_sliding_beam
Pointer to current beam sliding on.
void ResetSlideNode()
Move back to initial rail, reset 'broken' flag and recalculate closest position.
RailSegment * m_cur_rail_seg
Current rail segment we are sliding on.
float m_break_force
Force at which Slide Node breaks away from the rail (N)
static Ogre::Real getLenTo(const RailGroup *group, const Ogre::Vector3 &point)
bool sn_attach_foreign
Attach/detach to rails only on other vehicles.
float m_node_forces_ratio
Ratio of length along the slide beam where the virtual node is "0.0f = p1, 1.0f = p2".
const Ogre::Vector3 & GetSlideNodePosition() const
RailGroup * m_initial_railgroup
Initial Rail group on spawn.
A series of RailSegment-s for SlideNode to slide along. Can be closed in a loop.
RailSegment * FindClosestSegment(Ogre::Vector3 const &point)
Search for closest rail segment (the one with closest node in it) in the entire RailGroup.
std::vector< RailSegment > rg_segments
int rg_id
Spawn context - matching separately defined rails with slidenodes.
A single beam in a chain.
RailSegment(beam_t *beam)
RailSegment * CheckCurSlideSegment(Ogre::Vector3 const &point)
Check if the slidenode should skip to a neighbour rail segment.
Simulation: An edge in the softbody structure.
Physics: A vertex in the softbody structure.