Integrated rigidbodies into physics system

This commit is contained in:
Diren D Bharwani 2022-10-01 16:50:50 +08:00
parent 4f56a32a9b
commit 374f1a961d
6 changed files with 180 additions and 148 deletions

View File

@ -10,6 +10,7 @@
#include "Scripting/SHScriptEngine.h" #include "Scripting/SHScriptEngine.h"
#include "Math/Transform/SHTransformComponent.h" #include "Math/Transform/SHTransformComponent.h"
#include "Graphics/MiddleEnd/Interface/SHMaterialInstance.h" #include "Graphics/MiddleEnd/Interface/SHMaterialInstance.h"
#include "Physics/Components/SHRigidBodyComponent.h"
#include "Assets/SHAssetManager.h" #include "Assets/SHAssetManager.h"
@ -75,83 +76,86 @@ namespace Sandbox
customMat->SetProperty("data.alpha", 0.1f); customMat->SetProperty("data.alpha", 0.1f);
// Create Stress Test Objects // Create Stress Test Objects
static const SHVec3 TEST_OBJ_SCALE = { 0.05f, 0.05f, 0.05f }; //static const SHVec3 TEST_OBJ_SCALE = { 0.05f, 0.05f, 0.05f };
constexpr int NUM_ROWS = 100; //constexpr int NUM_ROWS = 100;
constexpr int NUM_COLS = 100; //constexpr int NUM_COLS = 100;
static const SHVec3 TEST_OBJ_SPACING = { 0.05f, 0.05f, 0.05f }; //static const SHVec3 TEST_OBJ_SPACING = { 0.05f, 0.05f, 0.05f };
static const SHVec3 TEST_OBJ_START_POS = { -(NUM_COLS / 2 * TEST_OBJ_SPACING.x) + 1.0f, -2.0f, -1.0f }; //static const SHVec3 TEST_OBJ_START_POS = { -(NUM_COLS / 2 * TEST_OBJ_SPACING.x) + 1.0f, -2.0f, -1.0f };
for (int y = 0; y < NUM_ROWS; ++y) //for (int y = 0; y < NUM_ROWS; ++y)
for (int x = 0; x < NUM_COLS; ++x) // for (int x = 0; x < NUM_COLS; ++x)
{ // {
auto entity = SHEntityManager::CreateEntity<SHRenderable, SHTransformComponent>(); // auto entity = SHEntityManager::CreateEntity<SHRenderable, SHTransformComponent>();
// auto& renderable = *SHComponentManager::GetComponent_s<SHRenderable>(entity);
// auto& transform = *SHComponentManager::GetComponent_s<SHTransformComponent>(entity);
// //renderable.Mesh = handles.front();
// renderable.Mesh = CUBE_MESH;
// renderable.SetMaterial(customMat);
// if (y == 50)
// renderable.GetModifiableMaterial()->SetProperty("data.color", SHVec4(1.0f, 0.0f, 0.0f, 1.0f));
// //Set initial positions
// transform.SetWorldPosition(TEST_OBJ_START_POS + SHVec3{
// x * TEST_OBJ_SPACING.x,
// y * TEST_OBJ_SPACING.y,
// 0.0f
// });
// //transform.SetWorldPosition({-1.0f, -1.0f, -1.0f});
// //transform.SetWorldRotation(3.14159265f * 1.5f, -3.14159265f / 2.0f, 0.0f);
// transform.SetLocalScale(TEST_OBJ_SCALE);
// stressTestObjects.emplace_back(entity);
// }
//auto raccoonSpin = SHEntityManager::CreateEntity<SHRenderable, SHTransformComponent>();
//auto& renderable = *SHComponentManager::GetComponent_s<SHRenderable>(raccoonSpin);
//auto& transform = *SHComponentManager::GetComponent_s<SHTransformComponent>(raccoonSpin);
//renderable.Mesh = handles.front();
//renderable.SetMaterial(customMat);
//renderable.GetModifiableMaterial()->SetProperty("data.color", SHVec4(0.0f, 0.0f, 0.0f, 0.0f));
//renderable.GetModifiableMaterial()->SetProperty("data.alpha", 1.0f);
//renderable.GetModifiableMaterial()->SetProperty("data.textureIndex", 1);
//transform.SetWorldPosition({ -3.0f, -1.0f, -1.0f });
//transform.SetLocalScale({ 5.0f, 5.0f, 5.0f });
auto entity = SHEntityManager::CreateEntity<SHRenderable, SHTransformComponent, SHRigidBodyComponent>();
auto& renderable = *SHComponentManager::GetComponent_s<SHRenderable>(entity); auto& renderable = *SHComponentManager::GetComponent_s<SHRenderable>(entity);
auto& transform = *SHComponentManager::GetComponent_s<SHTransformComponent>(entity); auto& transform = *SHComponentManager::GetComponent_s<SHTransformComponent>(entity);
auto& rb = *SHComponentManager::GetComponent_s<SHRigidBodyComponent>(entity);
renderable.Mesh = handles.front(); renderable.Mesh = CUBE_MESH;
renderable.SetMaterial(customMat); renderable.SetMaterial(customMat);
if (y == 50) transform.SetLocalScale(SHVec3::One * 0.25f);
renderable.GetModifiableMaterial()->SetProperty("data.color", SHVec4(1.0f, 0.0f, 0.0f, 1.0f)); transform.SetWorldPosition({0.0f, 2.0f, -1.0f});
//Set initial positions
transform.SetWorldPosition(TEST_OBJ_START_POS + SHVec3{
x * TEST_OBJ_SPACING.x,
y * TEST_OBJ_SPACING.y,
0.0f
});
//transform.SetWorldPosition({-1.0f, -1.0f, -1.0f});
//transform.SetWorldRotation(3.14159265f * 1.5f, -3.14159265f / 2.0f, 0.0f);
transform.SetLocalScale(TEST_OBJ_SCALE);
stressTestObjects.emplace_back(entity);
}
auto raccoonSpin = SHEntityManager::CreateEntity<SHRenderable, SHTransformComponent>();
auto& renderable = *SHComponentManager::GetComponent_s<SHRenderable>(raccoonSpin);
auto& transform = *SHComponentManager::GetComponent_s<SHTransformComponent>(raccoonSpin);
renderable.Mesh = handles.front();
renderable.SetMaterial(customMat);
renderable.GetModifiableMaterial()->SetProperty("data.color", SHVec4(0.0f, 0.0f, 0.0f, 0.0f));
renderable.GetModifiableMaterial()->SetProperty("data.alpha", 1.0f);
renderable.GetModifiableMaterial()->SetProperty("data.textureIndex", 1);
transform.SetWorldPosition({ -3.0f, -1.0f, -1.0f });
transform.SetLocalScale({ 5.0f, 5.0f, 5.0f });
//auto entity = SHEntityManager::CreateEntity<SHRenderable, SHTransformComponent>();
//auto& renderable = *SHComponentManager::GetComponent_s<SHRenderable>(entity);
//auto& transform = *SHComponentManager::GetComponent_s<SHTransformComponent>(entity);
//renderable.Mesh = handles.back();
//renderable.SetMaterial(customMat);
//transform.SetLocalScale(TEST_OBJ_SCALE);
//transform.SetWorldPosition({-1.0f, -1.0f, -1.0f});
// Create blank entity with a script // Create blank entity with a script
//testObj = SHADE::SHEntityManager::CreateEntity<SHRenderable, SHTransformComponent>(); //testObj = SHADE::SHEntityManager::CreateEntity<SHRenderable, SHTransformComponent>();
//auto& testObjRenderable = *SHComponentManager::GetComponent_s<SHRenderable>(testObj); //auto& testObjRenderable = *SHComponentManager::GetComponent<SHRenderable>(testObj);
//testObjRenderable.Mesh = CUBE_MESH; //testObjRenderable.Mesh = CUBE_MESH;
//testObjRenderable.SetMaterial(matInst); //testObjRenderable.SetMaterial(matInst);
SHADE::SHScriptEngine* scriptEngine = static_cast<SHADE::SHScriptEngine*>(SHADE::SHSystemManager::GetSystem<SHADE::SHScriptEngine>());
scriptEngine->AddScript(raccoonSpin, "RaccoonSpin");
auto raccoonShowcase = SHEntityManager::CreateEntity<SHRenderable, SHTransformComponent>(); //SHADE::SHScriptEngine* scriptEngine = static_cast<SHADE::SHScriptEngine*>(SHADE::SHSystemManager::GetSystem<SHADE::SHScriptEngine>());
auto& renderableShowcase = *SHComponentManager::GetComponent_s<SHRenderable>(raccoonShowcase); //scriptEngine->AddScript(raccoonSpin, "RaccoonSpin");
auto& transformShowcase = *SHComponentManager::GetComponent_s<SHTransformComponent>(raccoonShowcase);
renderableShowcase.Mesh = handles.front(); //auto raccoonShowcase = SHEntityManager::CreateEntity<SHRenderable, SHTransformComponent>();
renderableShowcase.SetMaterial(customMat); //auto& renderableShowcase = *SHComponentManager::GetComponent_s<SHRenderable>(raccoonShowcase);
renderableShowcase.GetModifiableMaterial()->SetProperty("data.color", SHVec4(0.0f, 0.0f, 0.0f, 0.0f)); //auto& transformShowcase = *SHComponentManager::GetComponent_s<SHTransformComponent>(raccoonShowcase);
renderableShowcase.GetModifiableMaterial()->SetProperty("data.alpha", 1.0f);
renderableShowcase.GetModifiableMaterial()->SetProperty("data.textureIndex", 1);
transformShowcase.SetWorldPosition({ 3.0f, -1.0f, -1.0f }); //renderableShowcase.Mesh = handles.front();
transformShowcase.SetLocalScale({ 5.0f, 5.0f, 5.0f }); //renderableShowcase.SetMaterial(customMat);
scriptEngine->AddScript(raccoonShowcase, "RaccoonShowcase"); //renderableShowcase.GetModifiableMaterial()->SetProperty("data.color", SHVec4(0.0f, 0.0f, 0.0f, 0.0f));
//renderableShowcase.GetModifiableMaterial()->SetProperty("data.alpha", 1.0f);
//renderableShowcase.GetModifiableMaterial()->SetProperty("data.textureIndex", 1);
//transformShowcase.SetWorldPosition({ 3.0f, -1.0f, -1.0f });
//transformShowcase.SetLocalScale({ 5.0f, 5.0f, 5.0f });
//scriptEngine->AddScript(raccoonShowcase, "RaccoonShowcase");
} }
void SBTestScene::Update(float dt) void SBTestScene::Update(float dt)

View File

@ -37,6 +37,9 @@ namespace SHADE
// Set default flags: Gravity & Sleeping enabled // Set default flags: Gravity & Sleeping enabled
flags |= 1U << 0; flags |= 1U << 0;
flags |= 1U << 1; flags |= 1U << 1;
// Set all dirty flags to true
dirtyFlags = 1023;
} }
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/

View File

@ -79,14 +79,40 @@ namespace SHADE
} }
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/
/* Public Function Member Definitions */ /* Setter Function Definitions */
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/
void SHPhysicsObject::SetPosition(const SHVec3& position) const noexcept
{
const rp3d::Vector3 RP3D_POS { position.x, position.y, position.z };
/*-----------------------------------------------------------------------------------*/ rp3d::Transform rp3dTF;
/* Private Function Member Definitions */ rp3dTF.setPosition(RP3D_POS);
/*-----------------------------------------------------------------------------------*/ rp3dTF.setOrientation(rp3dBody->getTransform().getOrientation());
rp3dBody->setTransform(rp3dTF);
}
void SHPhysicsObject::SetOrientation(const SHQuaternion& orientation) const noexcept
{
const rp3d::Quaternion RP3D_ORIENTATION { orientation.x, orientation.y, orientation.z, orientation.w };
rp3d::Transform rp3dTF;
rp3dTF.setPosition(rp3dBody->getTransform().getPosition());
rp3dTF.setOrientation(RP3D_ORIENTATION);
rp3dBody->setTransform(rp3dTF);
}
void SHPhysicsObject::SetRotation(const SHVec3& rotation) const noexcept
{
const rp3d::Quaternion RP3D_ORIENTATION = rp3d::Quaternion::fromEulerAngles( rotation.x, rotation.y, rotation.z );
rp3d::Transform rp3dTF;
rp3dTF.setPosition(rp3dBody->getTransform().getPosition());
rp3dTF.setOrientation(RP3D_ORIENTATION);
rp3dBody->setTransform(rp3dTF);
}
} // namespace SHADE } // namespace SHADE

View File

@ -55,14 +55,18 @@ namespace SHADE
/* Getter Functions */ /* Getter Functions */
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/
[[nodiscard]] virtual SHVec3 GetPosition () const noexcept; [[nodiscard]] SHVec3 GetPosition () const noexcept;
[[nodiscard]] virtual SHQuaternion GetOrientation () const noexcept; [[nodiscard]] SHQuaternion GetOrientation () const noexcept;
[[nodiscard]] virtual SHVec3 GetRotation () const noexcept; [[nodiscard]] SHVec3 GetRotation () const noexcept;
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/
/* Function Members */ /* Setter Functions */
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/
void SetPosition (const SHVec3& position) const noexcept;
void SetOrientation (const SHQuaternion& orientation) const noexcept;
void SetRotation (const SHVec3& rotation) const noexcept;
private: private:
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/
/* Data Members */ /* Data Members */

View File

@ -27,7 +27,7 @@ namespace SHADE
SHPhysicsSystem::SHPhysicsSystem() SHPhysicsSystem::SHPhysicsSystem()
: interpolationFactor { 0.0 } : interpolationFactor { 0.0 }
, fixedDT { 1.0 / 60.0 } , fixedDT { 60.0 }
, world { nullptr } , world { nullptr }
{} {}
@ -204,7 +204,11 @@ namespace SHADE
// Check if entity is already a physics object // Check if entity is already a physics object
auto* physicsObject = GetPhysicsObject(entityID); auto* physicsObject = GetPhysicsObject(entityID);
if (!physicsObject) if (!physicsObject)
{
physicsObject = &(map.emplace(entityID, SHPhysicsObject{}).first->second); physicsObject = &(map.emplace(entityID, SHPhysicsObject{}).first->second);
physicsObject->entityID = entityID;
}
// Get entity transform // Get entity transform
auto const* SHADE_TF = SHComponentManager::GetComponent_s<SHTransformComponent>(entityID); auto const* SHADE_TF = SHComponentManager::GetComponent_s<SHTransformComponent>(entityID);
@ -292,9 +296,23 @@ namespace SHADE
{ {
auto* system = reinterpret_cast<SHPhysicsSystem*>(GetSystem()); auto* system = reinterpret_cast<SHPhysicsSystem*>(GetSystem());
// Get dense arrays
auto& rbDense = SHComponentManager::GetDense<SHRigidBodyComponent>();
auto& cDense = SHComponentManager::GetDense<SHColliderComponent>();
// Update bodies and colliders if component is dirty // Update bodies and colliders if component is dirty
const auto& sceneGraph = SHSceneManager::GetCurrentSceneGraph(); system->SyncRigidBodyComponents(rbDense);
system->SyncComponents(sceneGraph);
// Sync transforms
for (auto& physicsObject : system->map | std::views::values)
{
const auto* TF = SHComponentManager::GetComponent<SHTransformComponent>(physicsObject.entityID);
if (TF->HasChanged())
{
physicsObject.SetPosition(TF->GetWorldPosition());
physicsObject.SetRotation(TF->GetWorldRotation());
}
}
} }
void SHPhysicsSystem::PhysicsFixedUpdate::Execute(double dt) noexcept void SHPhysicsSystem::PhysicsFixedUpdate::Execute(double dt) noexcept
@ -322,8 +340,7 @@ namespace SHADE
auto* system = reinterpret_cast<SHPhysicsSystem*>(GetSystem()); auto* system = reinterpret_cast<SHPhysicsSystem*>(GetSystem());
// Interpolate transforms for rendering // Interpolate transforms for rendering
const auto& sceneGraph = SHSceneManager::GetCurrentSceneGraph(); system->SyncTransforms();
system->SyncTransforms(sceneGraph);
// TODO(Diren): Handle trigger messages for scripting // TODO(Diren): Handle trigger messages for scripting
} }
@ -344,84 +361,56 @@ namespace SHADE
return &(it->second); return &(it->second);
} }
void SHPhysicsSystem::SyncComponents(const SHSceneGraph& sceneGraph) noexcept void SHPhysicsSystem::SyncRigidBodyComponents(std::vector<SHRigidBodyComponent>& denseArray) noexcept
{ {
static const auto SYNC_COMPONENTS = [&](SHSceneNode* node) if (denseArray.empty())
{
const EntityID ENTITY_ID = node->GetEntityID();
// Get physics object
auto const* physicsObject = GetPhysicsObject(ENTITY_ID);
if (!physicsObject)
return; return;
for (auto& comp : denseArray)
{
const EntityID ENTITY_ID = comp.GetEID();
// Get physicsObject
auto const* physicsObject = GetPhysicsObject(ENTITY_ID);
const bool RP3D_ACTIVE = physicsObject->rp3dBody->isActive(); const bool RP3D_ACTIVE = physicsObject->rp3dBody->isActive();
const bool NODE_ACTIVE = node->IsActive(); // TODO(Diren): Check if active in hierarchy
const bool COMPONENT_ACTIVE = comp.isActive;
// Sync rigid body if (RP3D_ACTIVE != COMPONENT_ACTIVE)
if (physicsObject->isRigidBody) physicsObject->rp3dBody->setIsActive(COMPONENT_ACTIVE);
if (!COMPONENT_ACTIVE)
continue;
if (comp.dirtyFlags > 0)
{ {
auto* rbComponent = SHComponentManager::GetComponent_s<SHRigidBodyComponent>(ENTITY_ID); SyncRB(physicsObject, &comp);
if (rbComponent->dirtyFlags > 0) comp.dirtyFlags = 0;
{ }
SyncRB(physicsObject, rbComponent); }
rbComponent->dirtyFlags = 0;
} }
void SHPhysicsSystem::SyncTransforms() noexcept
// Sync active states
const bool SHADE_ACTIVE = NODE_ACTIVE && rbComponent->isActive;
if (SHADE_ACTIVE != RP3D_ACTIVE)
physicsObject->rp3dBody->setIsActive(SHADE_ACTIVE);
}
// Sync colliders
if (physicsObject->hasColliders)
{ {
auto const* colliderComponent = SHComponentManager::GetComponent_s<SHColliderComponent>(ENTITY_ID); for (auto& pair : map)
}
// Sync transforms
auto const* tfComponent = SHComponentManager::GetComponent<SHTransformComponent>(ENTITY_ID);
if (tfComponent->HasChanged())
{ {
const SHVec3& SHADE_POS = tfComponent->GetWorldPosition(); const EntityID ENTITY_ID = pair.first;
const SHVec3& SHADE_ROT = tfComponent->GetWorldRotation(); SHPhysicsObject& physicsObject = pair.second;
const rp3d::Vector3 RP3D_POS { SHADE_POS.x, SHADE_POS.y, SHADE_POS.z };
const rp3d::Quaternion RP3D_ROT = rp3d::Quaternion::fromEulerAngles(SHADE_ROT.x, SHADE_ROT.y, SHADE_ROT.z);
physicsObject->rp3dBody->setTransform(rp3d::Transform{ RP3D_POS, RP3D_ROT });
}
};
sceneGraph.Traverse(SYNC_COMPONENTS);
}
void SHPhysicsSystem::SyncTransforms(const SHSceneGraph& sceneGraph) noexcept
{
static const auto SYNC_TRANSFORMS = [&](SHSceneNode* node)
{
const EntityID ENTITY_ID = node->GetEntityID();
// Get physics object
auto* physicsObject = GetPhysicsObject(ENTITY_ID);
if (!physicsObject)
return;
auto* tfComponent = SHComponentManager::GetComponent_s<SHTransformComponent>(ENTITY_ID);
rp3d::Vector3 rp3dPos; rp3d::Vector3 rp3dPos;
rp3d::Quaternion rp3dRot; rp3d::Quaternion rp3dRot;
const rp3d::Transform CURRENT_TF = physicsObject->rp3dBody->getTransform(); const rp3d::Transform CURRENT_TF = physicsObject.rp3dBody->getTransform();
// Check if transform should be interpolated // Check if transform should be interpolated
auto const* rbComponent = SHComponentManager::GetComponent_s<SHRigidBodyComponent>(ENTITY_ID);
if (rbComponent && rbComponent->IsInterpolating()) if (physicsObject.isRigidBody)
{ {
const rp3d::Transform PREV_TF = physicsObject->prevTransform; auto const* rbComponent = SHComponentManager::GetComponent<SHRigidBodyComponent>(ENTITY_ID);
if (rbComponent->IsInterpolating())
{
const rp3d::Transform PREV_TF = physicsObject.prevTransform;
const rp3d::Transform INTERPOLATED_TF = rp3d::Transform::interpolateTransforms(PREV_TF, CURRENT_TF, static_cast<rp3d::decimal>(interpolationFactor)); const rp3d::Transform INTERPOLATED_TF = rp3d::Transform::interpolateTransforms(PREV_TF, CURRENT_TF, static_cast<rp3d::decimal>(interpolationFactor));
@ -433,19 +422,24 @@ namespace SHADE
rp3dPos = CURRENT_TF.getPosition(); rp3dPos = CURRENT_TF.getPosition();
rp3dRot = CURRENT_TF.getOrientation(); rp3dRot = CURRENT_TF.getOrientation();
} }
}
else
{
rp3dPos = CURRENT_TF.getPosition();
rp3dRot = CURRENT_TF.getOrientation();
}
// Convert RP3D Transform to SHADE // Convert RP3D Transform to SHADE
const SHVec3 SHADE_POS = SHVec3{ rp3dPos.x, rp3dPos.y, rp3dPos.z }; const SHVec3 SHADE_POS = SHVec3{ rp3dPos.x, rp3dPos.y, rp3dPos.z };
const SHVec3 SHADE_ROT = SHQuaternion{ rp3dRot.x, rp3dRot.y, rp3dRot.z, rp3dRot.w }.ToEuler(); const SHVec3 SHADE_ROT = SHQuaternion{ rp3dRot.x, rp3dRot.y, rp3dRot.z, rp3dRot.w }.ToEuler();
auto* tfComponent = SHComponentManager::GetComponent<SHTransformComponent>(ENTITY_ID);
tfComponent->SetWorldPosition(SHADE_POS); tfComponent->SetWorldPosition(SHADE_POS);
tfComponent->SetWorldRotation(SHADE_ROT); tfComponent->SetWorldRotation(SHADE_ROT);
// Cache transforms // Cache transforms
physicsObject->prevTransform = CURRENT_TF; physicsObject.prevTransform = CURRENT_TF;
}; }
sceneGraph.Traverse(SYNC_TRANSFORMS);
} }
void SHPhysicsSystem::SyncRB(SHPhysicsObject const* physicsObject, const SHRigidBodyComponent* comp) noexcept void SHPhysicsSystem::SyncRB(SHPhysicsObject const* physicsObject, const SHRigidBodyComponent* comp) noexcept
@ -527,9 +521,9 @@ namespace SHADE
{ {
const rp3d::Vector3 CONSTRAINTS const rp3d::Vector3 CONSTRAINTS
{ {
rbFlags & 1U << 2 ? 1.0f : 0.0f, rbFlags & 1U << 2 ? 0.0f : 1.0f,
rbFlags & 1U << 3 ? 1.0f : 0.0f, rbFlags & 1U << 3 ? 0.0f : 1.0f,
rbFlags & 1U << 4 ? 1.0f : 0.0f rbFlags & 1U << 4 ? 0.0f : 1.0f
}; };
@ -540,9 +534,9 @@ namespace SHADE
{ {
const rp3d::Vector3 CONSTRAINTS const rp3d::Vector3 CONSTRAINTS
{ {
rbFlags & 1U << 5 ? 1.0f : 0.0f, rbFlags & 1U << 5 ? 0.0f : 1.0f,
rbFlags & 1U << 6 ? 1.0f : 0.0f, rbFlags & 1U << 6 ? 0.0f : 1.0f,
rbFlags & 1U << 7 ? 1.0f : 0.0f rbFlags & 1U << 7 ? 0.0f : 1.0f
}; };
rp3dRigidBody->setAngularLockAxisFactor(CONSTRAINTS); rp3dRigidBody->setAngularLockAxisFactor(CONSTRAINTS);

View File

@ -183,8 +183,9 @@ namespace SHADE
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/
SHPhysicsObject* GetPhysicsObject (EntityID entityID) noexcept; SHPhysicsObject* GetPhysicsObject (EntityID entityID) noexcept;
void SyncComponents (const SHSceneGraph& sceneGraph) noexcept; void SyncRigidBodyComponents (std::vector<SHRigidBodyComponent>& denseArray) noexcept;
void SyncTransforms (const SHSceneGraph& sceneGraph) noexcept; void SyncColliderComponents (std::vector<SHColliderComponent>& denseArray) noexcept;
void SyncTransforms () noexcept;
// TODO(Diren): Trigger handling // TODO(Diren): Trigger handling
static void SyncRB (SHPhysicsObject const* physicsObject, const SHRigidBodyComponent* comp) noexcept; static void SyncRB (SHPhysicsObject const* physicsObject, const SHRigidBodyComponent* comp) noexcept;