3#include <Jolt/Physics/Body/BodyID.h>
5#include <Common/Math.hpp>
6#include <Common/PhysicsLayer.hpp>
7#include <EngineCore/ECS/Entity.hpp>
8#include <EngineCore/Reflection/ComponentReflection.hpp>
10#include "ColliderComponent.hpp"
22 RigidBodyComponent() =
default;
23 RigidBodyComponent(
float mass, ColliderComponent* colliderComponent);
24 RigidBodyComponent Clone(Grindstone::WorldContextSet& cxt, entt::entity newEntityId)
const;
25 static void Construct(Grindstone::WorldContextSet&, entt::entity);
26 static void Destroy(Grindstone::WorldContextSet&, entt::entity);
28 void SetIsStatic(
bool isStatic);
29 void SetLayer(Grindstone::Physics::Layer layer);
30 void SetFriction(
float friction);
31 void SetRestitution(
float restitution);
32 void SetPosition(Math::Float3 pos);
33 void SetRotation(Math::Quaternion rot);
35 void ApplyForce(Math::Float3 pos, Math::Float3 force);
36 void ApplyCentralForce(Math::Float3 force);
37 void ApplyImpulse(Math::Float3 pos, Math::Float3 force);
38 void ApplyCentralImpulse(Math::Float3 force);
40 bool GetIsStatic()
const;
41 Grindstone::Physics::Layer GetLayer()
const;
42 float GetMass()
const;
43 float GetFriction()
const;
44 float GetRestitution()
const;
45 Math::Float3 GetPosition()
const;
46 Math::Quaternion GetRotation()
const;
48 void SetBodyID(JPH::BodyID bodyId);
49 JPH::BodyID GetBodyID()
const;
51 bool isStatic =
false;
52 Grindstone::Physics::Layer layer = 0;
55 float friction = 0.0f;
56 float restitution = 0.0f;
57 JPH::BodyID rigidBody;
64 void SetupRigidBodyComponentWithCollider(
65 Grindstone::WorldContextSet& cxt,
67 TransformComponent* transformComponent,
Definition WorldContextSet.hpp:11
Definition PhysicsLayer.hpp:6
Definition ArchiveContentFile.hpp:8
Definition ColliderComponent.hpp:14
Definition RigidBodyComponent.hpp:19