Added simulated head-tracking on VR simulator
A simple 1st person camera... still requires some work...
This commit is contained in:
parent
3396743aba
commit
5af1b4a7c9
3 changed files with 12 additions and 2 deletions
|
@ -37,6 +37,8 @@ int main()
|
||||||
|
|
||||||
Vector3 cubePosition = { 0.0f, 0.0f, 0.0f };
|
Vector3 cubePosition = { 0.0f, 0.0f, 0.0f };
|
||||||
|
|
||||||
|
SetCameraMode(camera, CAMERA_FIRST_PERSON);
|
||||||
|
|
||||||
SetTargetFPS(90); // Set our game to run at 90 frames-per-second
|
SetTargetFPS(90); // Set our game to run at 90 frames-per-second
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -45,7 +47,8 @@ int main()
|
||||||
{
|
{
|
||||||
// Update
|
// Update
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
UpdateVrTracking();
|
if (IsVrSimulator()) UpdateCamera(&camera);
|
||||||
|
else UpdateVrTracking();
|
||||||
|
|
||||||
if (IsKeyPressed(KEY_SPACE)) ToggleVrMode();
|
if (IsKeyPressed(KEY_SPACE)) ToggleVrMode();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
@ -61,7 +64,7 @@ int main()
|
||||||
DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED);
|
DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED);
|
||||||
DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, MAROON);
|
DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, MAROON);
|
||||||
|
|
||||||
DrawGrid(10, 1.0f);
|
DrawGrid(40, 1.0f);
|
||||||
|
|
||||||
End3dMode();
|
End3dMode();
|
||||||
|
|
||||||
|
|
|
@ -891,6 +891,7 @@ RLAPI void DestroyLight(Light light); // Des
|
||||||
RLAPI void InitVrDevice(int vdDevice); // Init VR device
|
RLAPI void InitVrDevice(int vdDevice); // Init VR device
|
||||||
RLAPI void CloseVrDevice(void); // Close VR device
|
RLAPI void CloseVrDevice(void); // Close VR device
|
||||||
RLAPI bool IsVrDeviceReady(void); // Detect if VR device (or simulator) is ready
|
RLAPI bool IsVrDeviceReady(void); // Detect if VR device (or simulator) is ready
|
||||||
|
RLAPI bool IsVrSimulator(void); // Detect if VR simulator is running
|
||||||
RLAPI void UpdateVrTracking(void); // Update VR tracking (position and orientation)
|
RLAPI void UpdateVrTracking(void); // Update VR tracking (position and orientation)
|
||||||
RLAPI void ToggleVrMode(void); // Enable/Disable VR experience (device or simulator)
|
RLAPI void ToggleVrMode(void); // Enable/Disable VR experience (device or simulator)
|
||||||
|
|
||||||
|
|
|
@ -2710,6 +2710,12 @@ bool IsVrDeviceReady(void)
|
||||||
return (vrDeviceReady || vrSimulator) && vrEnabled;
|
return (vrDeviceReady || vrSimulator) && vrEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Detect if VR simulator is running
|
||||||
|
bool IsVrSimulator(void)
|
||||||
|
{
|
||||||
|
return vrSimulator;
|
||||||
|
}
|
||||||
|
|
||||||
// Enable/Disable VR experience (device or simulator)
|
// Enable/Disable VR experience (device or simulator)
|
||||||
void ToggleVrMode(void)
|
void ToggleVrMode(void)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue