Vehicle keyboard steering!
Steering: Direction keys Handbrake: Right control
This commit is contained in:
@@ -53,6 +53,7 @@ void GameWorld::Initialize()
|
||||
box->Height = 0.5f;
|
||||
box->Depth = 2.5f;
|
||||
auto vehicle = AddComponent<Components::Vehicle>(car, "Vehicle");
|
||||
AddComponent<Components::Input>(car, "Input");
|
||||
}
|
||||
|
||||
for(int i = 0; i < 50; i++)
|
||||
|
||||
@@ -115,7 +115,16 @@ void Systems::PhysicsSystem::UpdateEntity(double dt, EntityID entity, EntityID p
|
||||
transformComponent->Orientation = glm::quat(orientation(3),orientation(0), orientation(1), orientation(2));
|
||||
}
|
||||
|
||||
|
||||
// HACK: Vehicle test-controls
|
||||
auto vehicleComponent = m_World->GetComponent<Components::Vehicle>(entity, "Vehicle");
|
||||
auto inputComponent = m_World->GetComponent<Components::Input>(entity, "Input");
|
||||
if (vehicleComponent && inputComponent)
|
||||
{
|
||||
hkpVehicleDriverInputAnalogStatus* deviceStatus = (hkpVehicleDriverInputAnalogStatus*)m_Vehicles[entity]->m_deviceStatus;
|
||||
deviceStatus->m_positionY = inputComponent->KeyState[GLFW_KEY_UP] * -1 + inputComponent->KeyState[GLFW_KEY_DOWN] * 1;
|
||||
deviceStatus->m_positionX = inputComponent->KeyState[GLFW_KEY_LEFT] * -1 + inputComponent->KeyState[GLFW_KEY_RIGHT] * 1;
|
||||
deviceStatus->m_handbrakeButtonPressed = inputComponent->KeyState[GLFW_KEY_RIGHT_CONTROL];
|
||||
}
|
||||
}
|
||||
|
||||
void Systems::PhysicsSystem::SetUpPhysicsState(EntityID entity, EntityID parent)
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "Components/Sphere.h"
|
||||
#include "Components/Box.h"
|
||||
#include "Components/Vehicle.h"
|
||||
#include "Components/Input.h"
|
||||
|
||||
// Math and base include
|
||||
|
||||
|
||||
Reference in New Issue
Block a user