SuperTuxKart
|
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 Vec3 & | getXYZ () 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 Vec3 & | getSmoothedXYZ () 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 ¤t_transform, const Vec3 ¤t_velocity) |
void | checkSmoothing (const btTransform ¤t_transform, const Vec3 ¤t_velocity) |
Adds a new error between graphical and physical position/rotation. | |
void | updateSmoothedGraphics (const btTransform ¤t_transform, const Vec3 ¤t_velocity, float dt) |
void | setSmoothedTransform (const btTransform &t) |
const btTransform & | getSmoothedTrans () const |
const Vec3 & | getSmoothedXYZ () 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< KartMotionState > | m_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. | |
void Moveable::createBody | ( | float | mass, |
btTransform & | trans, | ||
btCollisionShape * | shape, | ||
float | restitution | ||
) |
Creates the bullet rigid body for this moveable.
mass | Mass of this object. |
trans | Transform (=position and orientation) for this object). |
shape | Bullet collision shape for this object. |
|
virtual |
Enter flying mode.
Reimplemented in Kart.
|
inlinevirtual |
Reimplemented in AbstractKart.
|
inline |
Returns the roll of the kart between -pi and pi.
|
inlinevirtual |
Reimplemented in Cake.
|
virtual |
The reset position must be set before calling reset.
Reimplemented in AbstractKart, Flyable, GhostKart, Kart, KartRewinder, and KartWithStats.
void Moveable::setNode | ( | scene::ISceneNode * | n | ) |
Sets the mesh for this model.
n | The scene node. |
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.
t | New transform for this moveable. |
|
inlinevirtual |
Reimplemented in Cake.
|
inlinevirtual |
Sets the XYZ coordinates of the moveable.
Reimplemented in Kart.
|
virtual |
Updates the current position and rotation from the corresponding physics body, and then calls updateGraphics to position the model correctly.
ticks | Number of physics time steps - should be 1. |
Reimplemented in GhostKart, Kart, KartRewinder, and KartWithStats.
|
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).
offset_xyz | Offset to be added to the position. |
rotation | Additional rotation. |
|
pure virtual |
Called once per rendered frame.
It is used to only update any graphical effects.
dt | Time step size (since last call). |
Implemented in Flyable, Plunger, GhostKart, Kart, and KartRewinder.
void Moveable::updatePosition | ( | ) |
Updates the current position and rotation.
This function is also called by ghost karts for getHeading() to work.