Component responsible for basic physics simulation. Handles velocity, forces, gravity, and position updates.
More...
#include <RigidBodyComponent.hpp>
|
| | RigidBodyComponent ()=default |
| | Default constructor.
|
| float | GetMass () const |
| | Returns the mass of the rigid body.
|
| const DirectX::XMFLOAT3 & | GetVelocity () const |
| | Returns the current velocity.
|
| void | SetMass (float mass) |
| | Sets the mass of the rigid body.
|
| void | SetVelocity (const DirectX::XMFLOAT3 &vel) |
| | Sets the current velocity.
|
| void | AddForce (const DirectX::XMFLOAT3 &force) |
| | Adds a force to the rigid body. The force will be accumulated and applied during the next update.
|
| void | Start () override |
| | Called when the component starts. Logs that the rigid body has been attached to the GameObject.
|
| void | Update (float dt) override |
| | Updates the physics simulation each frame. Applies gravity, calculates acceleration, updates velocity, and moves the GameObject.
|
| void | OnDestroy () override |
| | Called when the component is destroyed. Logs that the rigid body has been removed.
|
| std::string | GetTypeName () const override |
| | Returns the type name of the component.
|
| virtual | ~Component ()=default |
| | Virtual destructor to allow proper cleanup of derived components.
|
Component responsible for basic physics simulation. Handles velocity, forces, gravity, and position updates.
◆ RigidBodyComponent()
| Engine::RigidBodyComponent::RigidBodyComponent |
( |
| ) |
|
|
default |
◆ AddForce()
| void Engine::RigidBodyComponent::AddForce |
( |
const DirectX::XMFLOAT3 & | force | ) |
|
|
inline |
Adds a force to the rigid body. The force will be accumulated and applied during the next update.
- Parameters
-
◆ GetMass()
| float Engine::RigidBodyComponent::GetMass |
( |
| ) |
const |
|
inline |
Returns the mass of the rigid body.
◆ GetTypeName()
| std::string Engine::RigidBodyComponent::GetTypeName |
( |
| ) |
const |
|
inlineoverridevirtual |
◆ GetVelocity()
| const DirectX::XMFLOAT3 & Engine::RigidBodyComponent::GetVelocity |
( |
| ) |
const |
|
inline |
Returns the current velocity.
◆ OnDestroy()
| void Engine::RigidBodyComponent::OnDestroy |
( |
| ) |
|
|
inlineoverridevirtual |
Called when the component is destroyed. Logs that the rigid body has been removed.
Reimplemented from Engine::Component.
◆ SetMass()
| void Engine::RigidBodyComponent::SetMass |
( |
float | mass | ) |
|
|
inline |
Sets the mass of the rigid body.
- Parameters
-
◆ SetVelocity()
| void Engine::RigidBodyComponent::SetVelocity |
( |
const DirectX::XMFLOAT3 & | vel | ) |
|
|
inline |
Sets the current velocity.
- Parameters
-
◆ Start()
| void Engine::RigidBodyComponent::Start |
( |
| ) |
|
|
inlineoverridevirtual |
◆ Update()
| void Engine::RigidBodyComponent::Update |
( |
float | dt | ) |
|
|
inlineoverridevirtual |
Updates the physics simulation each frame. Applies gravity, calculates acceleration, updates velocity, and moves the GameObject.
- Parameters
-
| dt | Delta time between frames |
Reimplemented from Engine::Component.
The documentation for this class was generated from the following file: