#include <Bullet.h>
Public Member Functions | |
Bullet (Physics *physics, H3DNode parentNode, H3DRes bulletRes, const float distance) | |
~Bullet () | |
void | update (float timeStep) |
bool | isActive () |
This class provides a graphical model simulation for a single bullet that has been shot by the player. After a given period of time or a given traveling distance the bullet deactivates itself and removes the graphics model. This state can be tested with
isActive()
.
Definition at line 18 of file Bullet.h.
Bullet::Bullet | ( | Physics * | physics, | |
H3DNode | parentNodeProxy, | |||
H3DRes | bulletRes, | |||
const float | distance | |||
) |
constructs a bullet with a graphics model and the maximum flying distance. In order to disconnect the bullet from the camera (which would disturb the bullet flight vector) a proxy node is used which must be given from the calling class.
parentNodeProxy | a proxy is a group node and acts as a fixed point for shot bullets. this proxy must contain the player's position and rotation at shooting time. this H3DNode is removed inside this class so the shooting class doesn't need to hold an instance of this proxy model. | |
bulletRes | this is the ressource to the bullet model | |
distance | this is the maximum distance that this bullet may fly. please note, that additionally the bullet deactivates after a certain period of time. |
Definition at line 22 of file Bullet.cpp.
Bullet::~Bullet | ( | ) |
Definition at line 41 of file Bullet.cpp.
bool Bullet::isActive | ( | ) |
returns whether this bullet is still flying or not
Definition at line 75 of file Bullet.cpp.
void Bullet::update | ( | float | timeStep | ) |
updates the graphics state of this bullet, that is: let the bullet fly in shooting direction
timeStep | the delta time to be rendered |
Definition at line 49 of file Bullet.cpp.