|
Building Game Engines
|
#include <PhysicsComponent.hpp>


Public Member Functions | |
| PhysicsComponent (TransformComponent *transform) | |
| PhysicsComponent (TransformComponent *transform, bool do_gravity) | |
| ~PhysicsComponent () | |
| void | Update () |
| void | Render (SDL_Renderer *renderer) |
Public Member Functions inherited from Component | |
| Component () | |
| virtual | ~Component ()=0 |
Handles position, velocity, and gravity.
| PhysicsComponent::PhysicsComponent | ( | TransformComponent * | transform | ) |
Constructs a physics component to act of the given transform component By default gravity will affect it
| transform | the transform to have physics applied to it |
| PhysicsComponent::PhysicsComponent | ( | TransformComponent * | transform, |
| bool | do_gravity | ||
| ) |
Pass false to disable gravity acting on the transform
| transform | |
| do_gravity |
| PhysicsComponent::~PhysicsComponent | ( | ) |
Destructor is empty, has no resources to free
|
virtual |
Nothing to render
Implements Component.
|
virtual |
Applies the physics to the transform Updates position based on velocity, and velocity based on gravity (if enabled)
Implements Component.

1.8.13