Anvil Engine
Loading...
Searching...
No Matches
RigidBodyComponent.h
Go to the documentation of this file.
1#pragma once
2#include "AMath.h"
3#include "IComponent.h"
4#include "AnvilPhysics.h"
5#include "AEntity.h"
6#include "ACore.h"
7
8class AEngine;
9
11{
12 public:
13 ABody* m_body = nullptr;
14 glm::vec3 m_size;
15 float m_mass;
17
18 RigidBodyComponent(glm::vec3 size, float mass = 1.0f, bool isStatic = false)
19 : m_size(size), m_mass(mass), m_isStatic(isStatic) {};
20 void OnInit(AEntity* owner) override;
21 void OnUpdate(float dt) override;
22 void OnRender(AShader* shader) override {};
23
24 void ApplyPush(glm::vec3 force);
25 void ApplyTorque(glm::vec3 torque);
26 bool IsGrounded();
27 void SetBouciness(float bounciness);
28};
float dt
Definition Main.cpp:10
#define ANVIL_API
Definition ACore.h:6
The main engine class that manages the application lifecycle, rendering, entities,...
Definition AEngine.h:25
Represents an entity in the game engine with position, rotation, scale and components.
Definition AEntity.h:16
Definition AShader.h:8
The IComponent class is an abstract base class that defines the interface for all components in the A...
Definition IComponent.h:12
virtual void OnUpdate(float dt)=0
Called once per frame to update the component's state.
virtual void OnInit(AEntity *owner)=0
Called when the component is initialized.
ABody * m_body
Definition RigidBodyComponent.h:13
void OnRender(AShader *shader) override
Called to render the component.
Definition RigidBodyComponent.h:22
float m_mass
Definition RigidBodyComponent.h:15
glm::vec3 m_size
Definition RigidBodyComponent.h:14
bool m_isStatic
Definition RigidBodyComponent.h:16
RigidBodyComponent(glm::vec3 size, float mass=1.0f, bool isStatic=false)
Definition RigidBodyComponent.h:18
Definition AnvilPhysics.h:29