SuperTuxKart
Loading...
Searching...
No Matches
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.
 
void setNode (scene::ISceneNode *n)
 Sets the mesh for this model.
 
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.
 
float getPitch () const
 Returns the pitch of the kart, restricted to between -pi/2 and pi/2.
 
float getRoll () const
 Returns the roll of the kart between -pi and pi.
 
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.
 
void setRotation (const btMatrix3x3 &m)
 Sets the rotation of the physical body this moveable.
 
void setRotation (const btQuaternion &q)
 Sets the rotation of the physical body this moveable.
 
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.
 
btRigidBody * getBody () const
 
void createBody (float mass, btTransform &trans, btCollisionShape *shape, float restitution)
 Creates the bullet rigid body for this moveable.
 
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.
 
void updatePosition ()
 Updates the current position and rotation.
 
virtual void updateGraphics (float dt)=0
 Called once per rendered frame.
 
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.
 
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.
 

Protected Attributes

btTransform m_transform
 The bullet transform of this rigid body.
 
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.
 
float m_heading
 The 'real' heading between -180 to 180 degrees.
 
float m_pitch
 The pitch between -90 and 90 degrees.
 
float m_roll
 The roll between -180 and 180 degrees.
 

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.

◆ flyUp()

void Moveable::flyUp ( )
virtual

Enter flying mode.

Reimplemented in Kart.

◆ getIdent()

virtual const std::string & Moveable::getIdent ( ) const
inlinevirtual

Reimplemented in AbstractKart.

◆ getRoll()

float Moveable::getRoll ( ) const
inline

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


◆ getVelocity()

virtual const btVector3 & Moveable::getVelocity ( ) const
inlinevirtual

Reimplemented in Cake.

◆ reset()

void Moveable::reset ( )
virtual

The reset position must be set before calling reset.

Reimplemented in AbstractKart, Flyable, GhostKart, Kart, KartRewinder, and KartWithStats.

◆ setNode()

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

Sets the mesh for this model.

Parameters
nThe scene node.

◆ 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.

◆ setVelocity()

virtual void Moveable::setVelocity ( const btVector3 &  v)
inlinevirtual

Reimplemented in Cake.

◆ 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 GhostKart, Kart, KartRewinder, and KartWithStats.

◆ 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 Flyable, Plunger, GhostKart, Kart, and KartRewinder.

◆ updatePosition()

void Moveable::updatePosition ( )

Updates the current position and rotation.

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


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