Elevate Engine 1
Loading...
Searching...
No Matches
Rigidbody.h
Go to the documentation of this file.
1#pragma once
6
7#include "glm/glm.hpp"
8
9namespace Elevate
10{
12 {
14
15 float m_staticFriction = 0; // static friction coefficient
17 float m_dynamicFriction = 0; // dynamic friction coefficient
19 float m_restitution = 1; // 0 = no rebound, 1 = bounce with no energy loss
21
23 };
24
26 {
28
29 glm::vec3 m_gravity = { 0, -9.81, 0 };
30 EXPOSE(m_gravity)
31
32 glm::vec3 m_force = { 0, 0, 0 };
33 EXPOSE(m_force)
34
35 glm::vec3 m_velocity = { 0, 0, 0 };
36 EXPOSE(m_velocity)
37
38 float m_mass = 100; // Mass in kg
39 EXPOSE(m_mass)
40
42 EXPOSE(material)
43
45 };
46
47 class Rigidbody : public Component
48 {
49 public:
51 EECATEGORY("Physics")
52
53 Rigidbody();
54 Rigidbody(const Rigidbody& other);
55
56 void Update() override;
57
58 private:
59 RigidbodyData m_data;
60 EXPOSE(m_data, Flatten)
61
63 };
64}
#define EECATEGORY(name)
#define END_STRUCT()
#define EXPOSE(param,...)
#define EditorIcon(path)
#define BEGIN_STRUCT(T)
#define Flatten
#define END_COMPONENT()
BEGIN_COMPONENT(Rigidbody, EditorIcon(std::string(Editor::Icons::COMPONENT_ICON_RIGIDBODY))) Rigidbody()
constexpr std::string_view COMPONENT_ICON_RIGIDBODY