SuperTuxKart
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
Moveable Class Referenceabstract
Inheritance diagram for Moveable:
Inheritance graph
[legend]

Public Member Functions

scene::ISceneNode * getNode () const
 Returns the scene node of this moveable. More...
 
void setNode (scene::ISceneNode *n)
 Sets the mesh for this model. More...
 
virtual const btVector3 & getVelocity () const
 
const btVector3 & getVelocityLC () const
 
virtual void setVelocity (const btVector3 &v)
 
const Vec3getXYZ () const
 
float getHeading () const
 Returns the heading between -pi and pi. More...
 
float getPitch () const
 Returns the pitch of the kart, restricted to between -pi/2 and pi/2. More...
 
float getRoll () const
 Returns the roll of the kart between -pi and pi. More...
 
const btQuaternion getRotation () const
 
virtual void flyUp ()
 Enter flying mode.
 
virtual void flyDown ()
 
virtual void stopFlying ()
 
virtual void setXYZ (const Vec3 &a)
 Sets the XYZ coordinates of the moveable. More...
 
void setRotation (const btMatrix3x3 &m)
 Sets the rotation of the physical body this moveable. More...
 
void setRotation (const btQuaternion &q)
 Sets the rotation of the physical body this moveable. More...
 
virtual void reset ()
 The reset position must be set before calling reset.
 
virtual void update (int ticks)
 Updates the current position and rotation from the corresponding physics body, and then calls updateGraphics to position the model correctly. More...
 
btRigidBody * getBody () const
 
void createBody (float mass, btTransform &trans, btCollisionShape *shape, float restitution)
 Creates the bullet rigid body for this moveable. More...
 
const btTransform & getTrans () const
 
void setTrans (const btTransform &t)
 Places this moveable at a certain location and stores this transform in this Moveable, so that it can be accessed easily. More...
 
void updatePosition ()
 Updates the current position and rotation. More...
 
virtual void updateGraphics (float dt)=0
 Called once per rendered frame. More...
 
void prepareSmoothing ()
 
void checkSmoothing ()
 
const btTransform & getSmoothedTrans () const
 
const Vec3getSmoothedXYZ () const
 
virtual const std::string & getIdent () const
 
- Public Member Functions inherited from SmoothNetworkBody
 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)
 

Protected Member Functions

void updateSmoothedGraphics (float dt)
 
virtual void updateGraphics (const Vec3 &off_xyz=Vec3(0.0f, 0.0f, 0.0f), const btQuaternion &off_rotation=btQuaternion(0.0f, 0.0f, 0.0f, 1.0f))
 Updates the graphics model. More...
 

Protected Attributes

btTransform m_transform
 The bullet transform of this rigid body. More...
 
UserPointer m_user_pointer
 
scene::ISceneNode * m_node
 
std::unique_ptr< btRigidBody > m_body
 
std::unique_ptr< KartMotionStatem_motion_state
 

Private Attributes

Vec3 m_velocityLC
 Velocity in kart coordinates. More...
 
float m_heading
 The 'real' heading between -180 to 180 degrees. More...
 
float m_pitch
 The pitch between -90 and 90 degrees. More...
 
float m_roll
 The roll between -180 and 180 degrees. More...
 

Member Function Documentation

◆ createBody()

void Moveable::createBody ( float  mass,
btTransform &  trans,
btCollisionShape *  shape,
float  restitution 
)

Creates the bullet rigid body for this moveable.

Parameters
massMass of this object.
transTransform (=position and orientation) for this object).
shapeBullet collision shape for this object.

◆ getHeading()

float Moveable::getHeading ( ) const
inline

Returns the heading between -pi and pi.

◆ getNode()

scene::ISceneNode* Moveable::getNode ( ) const
inline

Returns the scene node of this moveable.

◆ getPitch()

float Moveable::getPitch ( ) const
inline

Returns the pitch of the kart, restricted to between -pi/2 and pi/2.

◆ getRoll()

float Moveable::getRoll ( ) const
inline

Returns the roll of the kart between -pi and pi.

◆ setNode()

void Moveable::setNode ( scene::ISceneNode *  n)

Sets the mesh for this model.

Parameters
nThe scene node.

◆ setRotation() [1/2]

void Moveable::setRotation ( const btMatrix3x3 &  m)
inline

Sets the rotation of the physical body this moveable.

◆ setRotation() [2/2]

void Moveable::setRotation ( const btQuaternion &  q)
inline

Sets the rotation of the physical body this moveable.

◆ setTrans()

void Moveable::setTrans ( const btTransform &  t)

Places this moveable at a certain location and stores this transform in this Moveable, so that it can be accessed easily.

Parameters
tNew transform for this moveable.

◆ setXYZ()

virtual void Moveable::setXYZ ( const Vec3 a)
inlinevirtual

Sets the XYZ coordinates of the moveable.

Reimplemented in Kart.

◆ update()

void Moveable::update ( int  ticks)
virtual

Updates the current position and rotation from the corresponding physics body, and then calls updateGraphics to position the model correctly.

Parameters
ticksNumber of physics time steps - should be 1.

Reimplemented in Kart, KartWithStats, GhostKart, and KartRewinder.

◆ updateGraphics() [1/2]

void Moveable::updateGraphics ( const Vec3 offset_xyz = Vec3(0.0f, 0.0f, 0.0f),
const btQuaternion &  rotation = btQuaternion(0.0f, 0.0f, 0.0f, 1.0f) 
)
protectedvirtual

Updates the graphics model.

Mainly set the graphical position to be the same as the physics position, but uses offsets to position and rotation for special gfx effects (e.g. skidding will turn the karts more).

Parameters
offset_xyzOffset to be added to the position.
rotationAdditional rotation.

◆ updateGraphics() [2/2]

virtual void Moveable::updateGraphics ( float  dt)
pure virtual

Called once per rendered frame.

It is used to only update any graphical effects.

Parameters
dtTime step size (since last call).

Implemented in Kart, Flyable, Plunger, KartRewinder, and GhostKart.

◆ updatePosition()

void Moveable::updatePosition ( )

Updates the current position and rotation.

This function is also called by ghost karts for getHeading() to work.

Member Data Documentation

◆ m_heading

float Moveable::m_heading
private

The 'real' heading between -180 to 180 degrees.

◆ m_pitch

float Moveable::m_pitch
private

The pitch between -90 and 90 degrees.

◆ m_roll

float Moveable::m_roll
private

The roll between -180 and 180 degrees.

◆ m_transform

btTransform Moveable::m_transform
protected

The bullet transform of this rigid body.

◆ m_velocityLC

Vec3 Moveable::m_velocityLC
private

Velocity in kart coordinates.


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