Fixed various physics bugs and added Physics Material to Inspector #249
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue