Tramway SDK
Public Member Functions | Public Attributes | List of all members
tram::PathFollower Class Reference

Point constrained to a Path. More...

#include <framework/path.h>

Public Member Functions

 PathFollower (Path *path, vec3 initial_pos, PathType type)
 Creates a new PathFollower for a path. More...
 
void Advance (float)
 Advances the follower along the path. More...
 
void Project (vec3)
 
void TurnLeft ()
 
void TurnRight ()
 
void TurnStraight ()
 
vec3 GetPosition ()
 
vec3 GetTangent ()
 
void SetOrientation (vec3)
 

Public Attributes

float progress
 
uint32_t prev
 
uint32_t next
 
PathType type
 
PathType direction
 
Pathpath
 

Detailed Description

Point constrained to a Path.

When constructed, the PathFollower will project the initial position on the path, i.e. find the nearest point on the path. After that, you can use PathFollower::Advance() to push it back and forth on the path. The position of the PathFollower can be used to position an object, so that it appears to be following the given path.

Constructor & Destructor Documentation

◆ PathFollower()

tram::PathFollower::PathFollower ( Path path,
vec3  initial_pos,
PathType  type 
)

Creates a new PathFollower for a path.

Member Function Documentation

◆ Advance()

void tram::PathFollower::Advance ( float  distance)

Advances the follower along the path.

Parameters
distanceDistance along the path, in meters.

◆ GetPosition()

vec3 tram::PathFollower::GetPosition ( )

◆ GetTangent()

vec3 tram::PathFollower::GetTangent ( )

◆ Project()

void tram::PathFollower::Project ( vec3  projectable)

◆ SetOrientation()

void tram::PathFollower::SetOrientation ( vec3  orientation)

◆ TurnLeft()

void tram::PathFollower::TurnLeft ( )

◆ TurnRight()

void tram::PathFollower::TurnRight ( )

◆ TurnStraight()

void tram::PathFollower::TurnStraight ( )

Member Data Documentation

◆ direction

PathType tram::PathFollower::direction

◆ next

uint32_t tram::PathFollower::next

◆ path

Path* tram::PathFollower::path

◆ prev

uint32_t tram::PathFollower::prev

◆ progress

float tram::PathFollower::progress

◆ type

PathType tram::PathFollower::type

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