SuperTuxKart
Public Member Functions | Protected Member Functions | Private Attributes | Friends | List of all members
CannonAnimation Class Reference

This animation shoots the kart to a specified point on the track. More...

#include <cannon_animation.hpp>

Inheritance diagram for CannonAnimation:
Inheritance graph
[legend]

Public Member Functions

 CannonAnimation (AbstractKart *kart, CheckCannon *cc, float skid_rot)
 The constructor for the cannon animation. More...
 
 CannonAnimation (Flyable *flyable, CheckCannon *cc)
 Constructor for a flyable. More...
 
virtual void update (int ticks)
 Updates the kart animation. More...
 
virtual KartAnimationType getAnimationType () const
 
virtual void saveState (BareNetworkString *buffer)
 
virtual void restoreState (BareNetworkString *buffer)
 
- Public Member Functions inherited from AbstractKartAnimation
 AbstractKartAnimation (AbstractKart *kart, const std::string &name)
 Constructor. More...
 
virtual void updateGraphics (float dt)
 
virtual float getAnimationTimer () const
 Returns the current animation timer.
 
virtual const std::string & getName () const
 To easily allow printing the name of the animation being used atm. More...
 
void handleResetRace ()
 

Protected Member Functions

 CannonAnimation (AbstractKart *kart, BareNetworkString *buffer)
 The constructor for the cannon animation for kart during rewind.
 
 CannonAnimation (Flyable *flyable, BareNetworkString *buffer)
 The constructor for the cannon animation for flyable during rewind.
 
void init (Ipo *ipo, const Vec3 &start_left, const Vec3 &start_right, const Vec3 &end_left, const Vec3 &end_right, float skid_rot)
 Common initialisation for kart-based and flyable-based animations. More...
 
void initDeltaHeading (float skidding_rotation)
 
void restoreData (BareNetworkString *buffer)
 
- Protected Member Functions inherited from AbstractKartAnimation
void resetPowerUp ()
 In CTF mode call this to reset kart powerup when get hit.
 
void restoreBasicState (BareNetworkString *buffer)
 Used in constructor of sub-class as no virtual function can be used there.
 
float getMaximumHeight (const Vec3 &up_vector, float height_remove)
 Determine maximum rescue height with up-raycast.
 

Private Attributes

CheckCannonm_check_cannon
 The CheckCannon which created this animation. More...
 
float m_skid_rot
 
Vec3 m_delta
 This is the difference between the position of the kart when the cannon line is crossed and the curve interpolation at t=0. More...
 
AnimationBasem_curve
 Stores the curve interpolation for the cannon. More...
 
Flyablem_flyable
 If this animation is used for a flyable (e.g. More...
 
float m_start_line_length
 Length of the (adjusted, i.e. More...
 
float m_end_line_length
 Length of the (adjusted, i.e. More...
 
float m_fraction_of_line
 Stores the position of the kart relative to the line width at the current location. More...
 
btQuaternion m_delta_heading
 The initial heading of the kart when crossing the line. More...
 
uint32_t m_current_rotation
 Current rotation of the object, saved for rewinding usage if needed, it will be compressed by MiniGLM. More...
 

Friends

class KartRewinder
 
class Flyable
 

Additional Inherited Members

- Protected Attributes inherited from AbstractKartAnimation
AbstractKartm_kart
 A pointer to the kart which is animated by this class. More...
 
int m_end_ticks
 Time in ticks for the animation which ends in world count up ticks. More...
 
int m_created_ticks
 Time in ticks for the animation creation. More...
 
btTransform m_created_transform
 Transformation by the time the animation was created, used for rewind to recreate the animation with the same one. More...
 
int m_created_transform_compressed [4]
 

Detailed Description

This animation shoots the kart to a specified point on the track.

Constructor & Destructor Documentation

◆ CannonAnimation() [1/2]

CannonAnimation::CannonAnimation ( AbstractKart kart,
CheckCannon cc,
float  skid_rot 
)

The constructor for the cannon animation.

Parameters
kartThe kart to be animated. Can also be NULL if a basket ball etc is animated (e.g. cannon animation).
ccThe CheckCannon which created this animation.
end_left,end_rightLeft and right end points of the line at which the kart finishes.
skid_rotVisual rotation of the kart due to skidding (while this value can be queried, the AbstractkartAnimation constructor resets the value to 0, so it needs to be passed in.

◆ CannonAnimation() [2/2]

CannonAnimation::CannonAnimation ( Flyable flyable,
CheckCannon cc 
)

Constructor for a flyable.

It sets the kart data to NULL.

Member Function Documentation

◆ init()

void CannonAnimation::init ( Ipo ipo,
const Vec3 start_left,
const Vec3 start_right,
const Vec3 end_left,
const Vec3 end_right,
float  skid_rot 
)
protected

Common initialisation for kart-based and flyable-based animations.

Parameters
ipoThe IPO (blender interpolation curve) which the kart should follow.
start_left,start_rightLeft and right end points of the line that the kart just crossed.
end_left,end_rightLeft and right end points of the line at which the kart finishes.
skid_rotVisual rotation of the kart due to skidding (while this value can be queried, the AbstractkartAnimation constructor resets the value to 0, so it needs to be passed in.

◆ update()

void CannonAnimation::update ( int  ticks)
virtual

Updates the kart animation.

Parameters
ticksNumber of time steps - should be 1.

Reimplemented from AbstractKartAnimation.

Member Data Documentation

◆ m_check_cannon

CheckCannon* CannonAnimation::m_check_cannon
private

The CheckCannon which created this animation.

◆ m_current_rotation

uint32_t CannonAnimation::m_current_rotation
private

Current rotation of the object, saved for rewinding usage if needed, it will be compressed by MiniGLM.

◆ m_curve

AnimationBase* CannonAnimation::m_curve
private

Stores the curve interpolation for the cannon.

◆ m_delta

Vec3 CannonAnimation::m_delta
private

This is the difference between the position of the kart when the cannon line is crossed and the curve interpolation at t=0.

This is added to each interpolated curve value to give the final kart position (so the kart moves relative to the curve).

◆ m_delta_heading

btQuaternion CannonAnimation::m_delta_heading
private

The initial heading of the kart when crossing the line.

This is used to smoothly orient the kart towards the normal of the curve.

◆ m_end_line_length

float CannonAnimation::m_end_line_length
private

Length of the (adjusted, i.e.

taking kart width into account) end line.

◆ m_flyable

Flyable* CannonAnimation::m_flyable
private

If this animation is used for a flyable (e.g.

basket ball) instead of a kart, m_flyable is defined and m_kart is NULL.

◆ m_fraction_of_line

float CannonAnimation::m_fraction_of_line
private

Stores the position of the kart relative to the line width at the current location.

◆ m_start_line_length

float CannonAnimation::m_start_line_length
private

Length of the (adjusted, i.e.

taking kart width into account) start line.


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