This class is used together with the pluger to display a rubber band from the shooting kart to the plunger.
More...
#include <rubber_band.hpp>
|
| RubberBand (Plunger *plunger, AbstractKart *kart) |
| RubberBand constructor.
|
|
void | reset () |
|
void | updateGraphics (float dt) |
|
void | update (int ticks) |
| Updates the rubber band.
|
|
void | hit (AbstractKart *kart_hit, const Vec3 *track_xyz=NULL) |
| The plunger hit a kart or the track.
|
|
uint8_t | get8BitState () const |
|
void | set8BitState (uint8_t bit_state) |
|
void | remove () |
|
|
void | checkForHit (const Vec3 &k, const Vec3 &p) |
| Uses a raycast to see if anything has hit the rubber band.
|
|
void | updatePosition () |
| Updates the position of the rubber band.
|
|
|
Vec3 | m_hit_position |
| If rubber band is attached to track, the coordinates.
|
|
Plunger * | m_plunger |
| The plunger the rubber band is attached to.
|
|
AbstractKart * | m_owner |
| The kart who shot this plunger.
|
|
RubberBandTo | m_attached_state |
|
std::shared_ptr< SP::SPDynamicDrawCall > | m_dy_dc |
| The dynamic draw call of the rubber band.
|
|
irr::scene::IMeshSceneNode * | m_node |
|
AbstractKart * | m_hit_kart |
| The kart a plunger might have hit.
|
|
Vec3 | m_end_position |
| Stores the end of the rubber band (i.e.
|
|
This class is used together with the pluger to display a rubber band from the shooting kart to the plunger.
◆ RubberBandTo
Enumerator |
---|
RB_TO_PLUNGER | Rubber band is attached to plunger.
|
RB_TO_KART | Rubber band is attached to a kart hit.
|
RB_TO_TRACK | Rubber band is attached to track.
|
◆ RubberBand()
RubberBand constructor.
It creates a simple quad and attaches it to the root(!) of the graph. It's easier this way to get the right coordinates than attaching it to the plunger or kart, and trying to find the other coordinate.
- Parameters
-
plunger | Pointer to the plunger (non const, since the rubber band can trigger an explosion) |
kart | Reference to the kart. |
◆ checkForHit()
void RubberBand::checkForHit |
( |
const Vec3 & |
k, |
|
|
const Vec3 & |
p |
|
) |
| |
|
private |
Uses a raycast to see if anything has hit the rubber band.
- Parameters
-
k | Position of the kart = one end of the rubber band |
p | Position of the plunger = other end of the rubber band. |
◆ hit()
The plunger hit a kart or the track.
- Parameters
-
kart_hit | The kart hit, or NULL if the track was hit. |
track | _xyz The coordinated where the track was hit (NULL if a kart was hit. |
◆ update()
void RubberBand::update |
( |
int |
ticks | ) |
|
Updates the rubber band.
It takes the new position of the kart and the plunger, and sets the quad representing the rubber band appropriately. It then casts a ray along the rubber band to detect if anything is hit. If so, an explosion is triggered.
- Parameters
-
◆ updatePosition()
void RubberBand::updatePosition |
( |
| ) |
|
|
private |
Updates the position of the rubber band.
It especially sets the end position of the rubber band, i.e. the side attached to the plunger, track, or kart hit.
◆ m_end_position
Vec3 RubberBand::m_end_position |
|
private |
Stores the end of the rubber band (i.e.
the side attached to the plunger.
The documentation for this class was generated from the following files: