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>
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_dy_dc
The dynamic draw call of the rubber band.
◆ m_end_position
Vec3 RubberBand::m_end_position |
|
private |
Stores the end of the rubber band (i.e.
the side attached to the plunger.
◆ m_hit_kart
The kart a plunger might have hit.
◆ m_hit_position
Vec3 RubberBand::m_hit_position |
|
private |
If rubber band is attached to track, the coordinates.
◆ m_owner
The kart who shot this plunger.
◆ m_plunger
The plunger the rubber band is attached to.
The documentation for this class was generated from the following files: