#include <RigidbodyComponent.hpp>
|
| | RigidbodyComponent (TransformComponent *pos, Vec2D dim, Vec2D vel, float m, bool elastic=false, bool grav=false) |
| |
| | ~RigidbodyComponent () |
| |
| void | ApplyForce (Vec2D force) override |
| |
| void | ApplyAcceleration (Vec2D acceleration) override |
| |
| void | ApplyVelocity () override |
| |
| void | Update (SDL_Event e, int frame, std::vector< std::string > broadcastList) override |
| |
| void | ShowComponentEditor (bool *showEditor) override |
| |
| const char * | ComponentTypeName () override |
| |
| void | SetVelocity (Vec2D vel) override |
| |
| bool | IsKinematic () override |
| |
| bool | IsElastic () override |
| |
| bool | UsesGravity () override |
| |
| Vec2D | GetVelocity () override |
| |
| float | GetMass () override |
| |
| | IPhysicsComponent (TransformComponent *pos, Vec2D dim) |
| |
| | ~IPhysicsComponent () |
| |
| bool | IsColliding (IPhysicsComponent *other) |
| |
| virtual void | ApplyForce (Vec2D force) |
| |
| virtual void | ApplyAcceleration (Vec2D acceleration) |
| |
| virtual void | ApplyVelocity () |
| |
| virtual void | SetVelocity (Vec2D vel) |
| |
| virtual bool | IsKinematic () |
| |
| virtual bool | IsElastic () |
| |
| virtual bool | UsesGravity () |
| |
| Vec2D | GetPosition () |
| |
| Vec2D | GetDimensions () |
| |
| virtual Vec2D | GetVelocity () |
| |
| virtual float | GetMass () |
| |
| | Component () |
| |
| | ~Component () |
| |
| virtual void | Update (SDL_Event e, int frame, std::vector< std::string > broadcastList) |
| |
| virtual void | Render (SDL_Renderer *ren) |
| |
| virtual void | ShowComponentEditor (bool *showEditor) |
| |
| virtual bool | HasTag (ComponentTag t) |
| |
| virtual const char * | ComponentTypeName () |
| |
| void | ParseAndUpdateBroadcast (std::vector< std::string > broadcastList) |
| |
|
|
Vec2D | velocity |
| |
|
float | mass |
| |
|
bool | isElastic |
| |
|
bool | usesGravity |
| |
|
|
TransformComponent * | m_position |
| |
| Vec2D | dimensions |
| |
|
std::vector< ComponentTag > | tags = {ComponentTag::Physics} |
| |
|
std::vector< ComponentTag > | tags |
| |
|
std::vector< std::string > | previousBroadcasts |
| |
|
std::vector< std::string > | pendingBroadcasts |
| |
An implementation of IPhysicsComponent to allow for physics-based collisions.
- See also
- PhysicsEngine
◆ RigidbodyComponent()
Construct a new Rigidbody Component object.
- Parameters
-
| pos | the TransformComponent of the parent GameObject |
| dim | the dimensions of the Rigidbody |
| vel | the velocity of the Rigidbody |
| m | the mass of the Rigidbody |
| elastic | whether the Rigidbody uses elastic collisions. Defaults to false. |
| grav | whether the Rigidbody is affected by gravity. Defaults to false. |
◆ ~RigidbodyComponent()
| RigidbodyComponent::~RigidbodyComponent |
( |
| ) |
|
◆ ApplyAcceleration()
| void RigidbodyComponent::ApplyAcceleration |
( |
Vec2D |
acceleration | ) |
|
|
overridevirtual |
◆ ApplyForce()
| void RigidbodyComponent::ApplyForce |
( |
Vec2D |
force | ) |
|
|
overridevirtual |
◆ ApplyVelocity()
| void RigidbodyComponent::ApplyVelocity |
( |
| ) |
|
|
overridevirtual |
◆ ComponentTypeName()
| const char * RigidbodyComponent::ComponentTypeName |
( |
| ) |
|
|
inlineoverridevirtual |
◆ GetMass()
| float RigidbodyComponent::GetMass |
( |
| ) |
|
|
overridevirtual |
◆ GetVelocity()
| Vec2D RigidbodyComponent::GetVelocity |
( |
| ) |
|
|
overridevirtual |
◆ IsElastic()
| bool RigidbodyComponent::IsElastic |
( |
| ) |
|
|
overridevirtual |
◆ IsKinematic()
| bool RigidbodyComponent::IsKinematic |
( |
| ) |
|
|
overridevirtual |
◆ SetVelocity()
| void RigidbodyComponent::SetVelocity |
( |
Vec2D |
vel | ) |
|
|
overridevirtual |
◆ ShowComponentEditor()
| void RigidbodyComponent::ShowComponentEditor |
( |
bool * |
showEditor | ) |
|
|
overridevirtual |
◆ Update()
| void RigidbodyComponent::Update |
( |
SDL_Event |
e, |
|
|
int |
frame, |
|
|
std::vector< std::string > |
broadcastList |
|
) |
| |
|
overridevirtual |
Move the RigidbodyComponent every frame. Updates the state of the component object. Called by the Engine every tick
- Parameters
-
| e | any inputs given by the user |
| frame | what frame is the game currently displaying |
| broadcastList | a list to be used to send messages between components |
- See also
- ParseAndUpdateBroadcast()
Reimplemented from Component.
◆ UsesGravity()
| bool RigidbodyComponent::UsesGravity |
( |
| ) |
|
|
overridevirtual |
The documentation for this class was generated from the following files: