A reimplementation of Mario Kart Wii's physics engine in C++
Loading...
Searching...
No Matches
Field::SphereLink Class Reference

#include <SphereLink.hh>

Description

One link in a chain where each link's position is limited by the other links.

Definition at line 8 of file SphereLink.hh.

Public Member Functions

void initLinkLen (f32 length)
 
void init ()
 
void calcStiffness ()
 
void calc ()
 
void calcConstraints (f32 scale)
 
void checkCollision ()
 
void calcPos ()
 
bool isLeader () const
 
Setters
void setPrev (SphereLink *prev)
 
void setNext (SphereLink *next)
 
void setPos (const EGG::Vector3f &pos)
 
void setVel (const EGG::Vector3f &vel)
 
void addSpringForce (const EGG::Vector3f &force)
 

Getters

f32 linkLen () const
 
const EGG::Vector3fpos () const
 
const EGG::Vector3fup () const
 
static constexpr const EGG::Vector3fGravity ()
 

Private Member Functions

void calcSpring ()
 

Private Attributes

SphereLinkm_prev
 
SphereLinkm_next
 
f32 m_linkLen
 The maximum distance between this link and the previous (forward) link.
 
EGG::Vector3f m_pos
 
EGG::Vector3f m_vel
 
EGG::Vector3f m_springForce
 Prevents links from stretching past their m_linkLen.
 
EGG::Vector3f m_up
 
bool m_touchingGround
 

Static Private Attributes

static constexpr EGG::Vector3f GRAVITY = EGG::Vector3f(0.0f, 2.5f, 0.0f)
 

Constructor & Destructor Documentation

◆ SphereLink()

Field::SphereLink::SphereLink ( )

Definition at line 7 of file SphereLink.cc.

Member Function Documentation

◆ addSpringForce()

void Field::SphereLink::addSpringForce ( const EGG::Vector3f & force)
inline

Definition at line 42 of file SphereLink.hh.

◆ calc()

void Field::SphereLink::calc ( )
0x806F1A54

Definition at line 51 of file SphereLink.cc.

◆ calcConstraints()

void Field::SphereLink::calcConstraints ( f32 scale)
0x806F2490

Definition at line 72 of file SphereLink.cc.

◆ calcPos()

void Field::SphereLink::calcPos ( )

Definition at line 153 of file SphereLink.cc.

◆ calcSpring()

void Field::SphereLink::calcSpring ( )
private0x806F1C58

Definition at line 161 of file SphereLink.cc.

◆ calcStiffness()

void Field::SphereLink::calcStiffness ( )
0x806F2074

Definition at line 26 of file SphereLink.cc.

◆ checkCollision()

void Field::SphereLink::checkCollision ( )
0x806F2A38

Definition at line 116 of file SphereLink.cc.

◆ Gravity()

static constexpr const EGG::Vector3f & Field::SphereLink::Gravity ( )
inlinestaticnodiscardconstexpr

Definition at line 60 of file SphereLink.hh.

◆ init()

void Field::SphereLink::init ( )

Definition at line 17 of file SphereLink.cc.

◆ initLinkLen()

void Field::SphereLink::initLinkLen ( f32 length)
0x806F1194

Definition at line 12 of file SphereLink.cc.

◆ isLeader()

bool Field::SphereLink::isLeader ( ) const
inlinenodiscard

Definition at line 21 of file SphereLink.hh.

◆ linkLen()

f32 Field::SphereLink::linkLen ( ) const
inlinenodiscard

Definition at line 48 of file SphereLink.hh.

◆ pos()

const EGG::Vector3f & Field::SphereLink::pos ( ) const
inlinenodiscard

Definition at line 52 of file SphereLink.hh.

◆ setNext()

void Field::SphereLink::setNext ( SphereLink * next)
inline

Definition at line 30 of file SphereLink.hh.

◆ setPos()

void Field::SphereLink::setPos ( const EGG::Vector3f & pos)
inline

Definition at line 34 of file SphereLink.hh.

◆ setPrev()

void Field::SphereLink::setPrev ( SphereLink * prev)
inline

Definition at line 26 of file SphereLink.hh.

◆ setVel()

void Field::SphereLink::setVel ( const EGG::Vector3f & vel)
inline

Definition at line 38 of file SphereLink.hh.

◆ up()

const EGG::Vector3f & Field::SphereLink::up ( ) const
inlinenodiscard

Definition at line 56 of file SphereLink.hh.

Member Data Documentation

◆ GRAVITY

EGG::Vector3f Field::SphereLink::GRAVITY = EGG::Vector3f(0.0f, 2.5f, 0.0f)
staticconstexprprivate

Definition at line 77 of file SphereLink.hh.

◆ m_linkLen

f32 Field::SphereLink::m_linkLen
private

The maximum distance between this link and the previous (forward) link.

Definition at line 70 of file SphereLink.hh.

◆ m_next

SphereLink* Field::SphereLink::m_next
private

Definition at line 69 of file SphereLink.hh.

◆ m_pos

EGG::Vector3f Field::SphereLink::m_pos
private

Definition at line 71 of file SphereLink.hh.

◆ m_prev

SphereLink* Field::SphereLink::m_prev
private

Definition at line 68 of file SphereLink.hh.

◆ m_springForce

EGG::Vector3f Field::SphereLink::m_springForce
private

Prevents links from stretching past their m_linkLen.

Definition at line 73 of file SphereLink.hh.

◆ m_touchingGround

bool Field::SphereLink::m_touchingGround
private

Definition at line 75 of file SphereLink.hh.

◆ m_up

EGG::Vector3f Field::SphereLink::m_up
private

Definition at line 74 of file SphereLink.hh.

◆ m_vel

EGG::Vector3f Field::SphereLink::m_vel
private

Definition at line 72 of file SphereLink.hh.