54 virtual void Create()
override;
55 virtual void Destroy()
override;
59 virtual void Tick(
float deltaTime)
override;
63 virtual void Render()
override;
66 virtual void SetTransform(
const glm::mat4& transform)
override;
68 void EnablePhysics(
bool enable);
69 void EnableCollision(
bool enable);
70 void EnableOverlaps(
bool enable);
71 bool IsPhysicsEnabled()
const;
72 bool IsCollisionEnabled()
const;
73 bool AreOverlapsEnabled()
const;
75 float GetCullDistance()
const;
76 void SetCullDistance(
float cullDistance);
78 void EnableOccluder(
bool enable);
79 bool IsOccluder()
const;
80 void EnableOccludee(
bool enable);
81 bool IsOccludee()
const;
84 void SetOcclusionSlot(uint32_t slot, glm::vec3 bakedCenter);
85 uint32_t GetOcclusionSlot()
const;
86 glm::vec3 GetOcclusionBakedCenter()
const;
90 void SetOcclusionMatchBox(
const AABB& localBox);
91 AABB GetOcclusionMatchAABB()
const;
93 float GetMass()
const;
94 float GetLinearDamping()
const;
95 float GetAngularDamping()
const;
96 float GetRestitution()
const;
97 float GetFriction()
const;
98 float GetRollingFriction();
99 glm::vec3 GetLinearFactor()
const;
100 glm::vec3 GetAngularFactor()
const;
101 uint8_t GetCollisionGroup()
const;
102 uint8_t GetCollisionMask()
const;
104 void SetMass(
float mass);
105 void SetLinearDamping(
float linearDamping);
106 void SetAngularDamping(
float angularDamping);
107 void SetRestitution(
float restitution);
108 void SetFriction(
float friction);
109 void SetRollingFriction(
float rollingFriction);
110 void SetLinearFactor(glm::vec3 linearFactor);
111 void SetAngularFactor(glm::vec3 angularFactor);
112 void SetCollisionGroup(uint8_t group);
113 void SetCollisionMask(uint8_t mask);
115 glm::vec3 GetLinearVelocity()
const;
116 glm::vec3 GetAngularVelocity()
const;
118 void AddLinearVelocity(glm::vec3 deltaVelocity);
119 void AddAngularVelocity(glm::vec3 deltaVelocity);
120 void SetLinearVelocity(glm::vec3 linearVelocity);
121 void SetAngularVelocity(glm::vec3 angularVelocity);
122 void AddForce(glm::vec3 force);
123 void AddImpulse(glm::vec3 impulse);
126 void FullSyncRigidBodyTransform();
128 void SyncRigidBodyTransform();
129 void SyncRigidBodyMass();
130 void SyncCollisionFlags();
132 void EnableCastShadows(
bool enable);
133 bool ShouldCastShadows()
const;
135 void EnableReceiveShadows(
bool enable);
136 bool ShouldReceiveShadows()
const;
138 void EnableReceiveSimpleShadows(
bool enable);
139 bool ShouldReceiveSimpleShadows()
const;
141 uint8_t GetLightingChannels()
const;
142 void SetLightingChannels(uint8_t channels);
146 btRigidBody* GetRigidBody();
147 btCollisionShape* GetCollisionShape();
148 void SetCollisionShape(btCollisionShape* newShape);
151 bool SweepToWorldPosition(glm::vec3 position,
SweepTestResult& outSweepResult, uint8_t mask = 0,
bool testOnly =
false);
152 bool SweepTest(glm::vec3 position,
SweepTestResult& outSweepResult, uint8_t mask = 0);
155 virtual Bounds GetLocalBounds()
const;
158 virtual AABB GetLocalAABB()
const;
164 glm::vec4 GetCollisionDebugColor();
168 static btCollisionShape* GetEmptyCollisionShape();
170 bool IsRigidBodyInWorld()
const;
171 void EnableRigidBody(
bool enable);
172 void DestroyComponentCollisionShape();
174 btRigidBody* mRigidBody =
nullptr;
175 PolyphaseMotionState* mMotionState =
nullptr;
176 btCollisionShape* mCollisionShape =
nullptr;
178 float mCullDistance = 0.0f;
181 uint32_t mOcclusionSlot = 0;
182 glm::vec3 mOcclusionBakedCenter = {};
184 bool mHasOcclusionMatchBox =
false;
188 float mRestitution = 0.0f;
189 float mFriction = 0.5f;
192 uint8_t mLightingChannels = 0x01;
194 bool mPhysicsEnabled =
false;
195 bool mCollisionEnabled =
false;
196 bool mOverlapsEnabled =
false;
197 bool mCastShadows =
false;
198 bool mReceiveShadows =
true;
199 bool mReceiveSimpleShadows =
true;
200 bool mOccluder =
false;
201 bool mOccludee =
false;