SuperTuxKart
Public Member Functions | Private Types | Private Attributes | List of all members
SmoothNetworkBody Class Reference
Inheritance diagram for SmoothNetworkBody:
Inheritance graph
[legend]

Public Member Functions

 SmoothNetworkBody (bool enable=false)
 
void reset ()
 
void setEnable (bool val)
 
bool isEnabled () const
 
void setSmoothRotation (bool val)
 
void setAdjustVerticalOffset (bool val)
 
void prepareSmoothing (const btTransform &current_transform, const Vec3 &current_velocity)
 
void checkSmoothing (const btTransform &current_transform, const Vec3 &current_velocity)
 Adds a new error between graphical and physical position/rotation. More...
 
void updateSmoothedGraphics (const btTransform &current_transform, const Vec3 &current_velocity, float dt)
 
void setSmoothedTransform (const btTransform &t)
 
const btTransform & getSmoothedTrans () const
 
const Vec3getSmoothedXYZ () const
 
void setMinAdjustLength (float val)
 
void setMaxAdjustLength (float val)
 
void setMinAdjustSpeed (float val)
 
void setMaxAdjustTime (float val)
 
void setAdjustLengthThreshold (float val)
 

Private Types

enum  SmoothingState { SS_NONE = 0, SS_TO_ADJUST, SS_TO_REAL }
 

Private Attributes

std::pair< Vec3, btQuaternion > m_start_smoothing_postion
 Client prediction in networked games might cause the visual and physical position to be different. More...
 
std::pair< Vec3, btQuaternion > m_adjust_position
 
Vec3 m_adjust_control_point
 
std::pair< btTransform, Vec3m_prev_position_data
 
btTransform m_smoothed_transform
 
float m_adjust_time
 
float m_adjust_time_dt
 
SmoothingState m_smoothing
 
bool m_enabled
 
bool m_smooth_rotation
 
bool m_adjust_vertical_offset
 
float m_min_adjust_length
 
float m_max_adjust_length
 
float m_min_adjust_speed
 
float m_max_adjust_time
 
float m_adjust_length_threshold
 

Member Function Documentation

◆ checkSmoothing()

void SmoothNetworkBody::checkSmoothing ( const btTransform &  current_transform,
const Vec3 current_velocity 
)

Adds a new error between graphical and physical position/rotation.

Called in case of a rewind to allow to for smoothing the visuals in case of incorrect client prediction.

Member Data Documentation

◆ m_start_smoothing_postion

std::pair<Vec3, btQuaternion> SmoothNetworkBody::m_start_smoothing_postion
private

Client prediction in networked games might cause the visual and physical position to be different.

For visual smoothing these variable accumulate the error and reduces it over time.


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