Grindstone Game Engine
v0.2.0
An open source game engine and toolkit.
Loading...
Searching...
No Matches
RigidBodyComponent.hpp
1
#pragma once
2
3
#include "Common/Math.hpp"
4
#include "EngineCore/ECS/Entity.hpp"
5
#include "EngineCore/Reflection/ComponentReflection.hpp"
6
#include "ColliderComponent.hpp"
7
8
class
btRigidBody;
9
10
namespace
Grindstone {
11
struct
TransformComponent;
12
13
namespace
Physics {
14
struct
ColliderComponent;
15
16
void
SetupRigidBodyComponent(entt::registry&, entt::entity);
17
void
DestroyRigidBodyComponent(entt::registry&, entt::entity);
18
19
struct
RigidBodyComponent
{
20
RigidBodyComponent
() =
default
;
21
RigidBodyComponent
(
float
mass,
ColliderComponent
* colliderComponent);
22
23
void
SetCollisionShape(
ColliderComponent
* colliderComponent);
24
void
SetFriction(
float
friction);
25
void
SetRestitution(
float
restitution);
26
void
SetDamping(
float
linear,
float
rotational);
27
28
void
ApplyForce(
Math::Float3
pos,
Math::Float3
force);
29
void
ApplyCentralForce(
Math::Float3
force);
30
void
ApplyImpulse(
Math::Float3
pos,
Math::Float3
force);
31
void
ApplyCentralImpulse(
Math::Float3
force);
32
33
float
GetMass()
const
;
34
float
GetFriction()
const
;
35
float
GetRestitution()
const
;
36
float
GetDampingLinear()
const
;
37
float
GetDampingRotational()
const
;
38
private
:
39
float
mass = 0.0f;
40
float
friction = 0.0f;
41
float
restitution = 0.0f;
42
float
dampingLinear = 0.0f;
43
float
dampingRotational = 0.0f;
44
public
:
45
btRigidBody* rigidBody =
nullptr
;
46
47
REFLECT(
"RigidBody"
)
48
};
49
50
void
SetupRigidBodyComponentWithCollider(
51
RigidBodyComponent
* rigidBodyComponent,
52
TransformComponent
* transformComponent,
53
ColliderComponent
* colliderComponent
54
);
55
}
56
}
Grindstone::TransformComponent
Definition
TransformComponent.hpp:12
Grindstone::Math.Float3
Definition
FloatVectors.cs:108
Grindstone::Physics::ColliderComponent
Definition
ColliderComponent.hpp:9
Grindstone::Physics::RigidBodyComponent
Definition
RigidBodyComponent.hpp:19
sources
code
Plugins
PhysicsBullet
Components
RigidBodyComponent.hpp
Generated by
1.12.0