Readded testing function in physics routines for future use

This commit is contained in:
Diren D Bharwani 2022-11-22 20:00:58 +08:00
parent c4e391a6db
commit dab51ee4cf
1 changed files with 35 additions and 1 deletions

View File

@ -21,6 +21,13 @@
#include "Input/SHInputManager.h"
/*-------------------------------------------------------------------------------------*/
/* Local Functions */
/*-------------------------------------------------------------------------------------*/
void testFunction();
/////////////////////////////////////////////////////////////////////////////////////////
namespace SHADE
{
@ -135,7 +142,7 @@ namespace SHADE
const double FIXED_DT = physicsSystem->fixedDT;
accumulatedTime += dt;
testFunction();
//testFunction();
int count = 0;
while (accumulatedTime > FIXED_DT)
@ -359,5 +366,32 @@ namespace SHADE
}
} // namespace SHADE
/////////////////////////////////////////////////////////////////////////////////////////
void testFunction()
{
using namespace SHADE;
// Test movement
const float forceModifier = 25.0f;
EntityID eid = 65538;
if (SHEntityManager::IsValidEID(eid))
{
auto* rb = SHComponentManager::GetComponent_s<SHRigidBodyComponent>(eid);
if (rb)
{
if (SHInputManager::GetKey(SHInputManager::SH_KEYCODE::W))
rb->AddForce(-SHVec3::UnitZ * forceModifier);
if (SHInputManager::GetKey(SHInputManager::SH_KEYCODE::A))
rb->AddForce(-SHVec3::UnitX * forceModifier);
if (SHInputManager::GetKey(SHInputManager::SH_KEYCODE::S))
rb->AddForce(SHVec3::UnitZ * forceModifier);
if (SHInputManager::GetKey(SHInputManager::SH_KEYCODE::D))
rb->AddForce(SHVec3::UnitX * forceModifier);
}
}
}