History

have the oculus drive the body yaw, head pitch, and head roll

Stephen Birarda committed 13 years ago

Commit 2f9c16f1 parent cc38e4c2 files · +18 −9Browse files

Showing the changes to interface/src/main.cpp (1 of 2 files). Show all

Unified · Split

interface/src/main.cpp+9−5
@@ -15,8 +15,6 @@ · 14 unmodified lines
1515 // Welcome Aboard!
1616 //
1717
18−
19−
2018 #include <math.h>
2119 #include <string.h>
2220 #include <sstream>
@@ -421,8 +419,10 @@ void updateAvatar(float deltaTime) { · 398 unmodified lines
421419 if (OculusManager::isConnected()) {
422420 float yaw, pitch, roll;
423421 OculusManager::getEulerAngles(yaw, pitch, roll);
422+
424423 myAvatar.setBodyYaw(yaw);
425− myAvatar.setRenderPitch(pitch);
424+ myAvatar.setHeadPitch(-pitch);
425+ myAvatar.setHeadRoll(-roll);
426426 }
427427
428428 // Get audio loudness data from audio input device
@@ -1008,14 +1008,18 @@ void display(void) · 579 unmodified lines
10081008 myCamera.setTargetPosition(myAvatar.getHeadPosition());
10091009 myCamera.setTargetRotation(myAvatar.getBodyYaw() - 180.0f, 0.0f, 0.0f);
10101010
1011− } else if (myCamera.getMode() == CAMERA_MODE_FIRST_PERSON) {
1011+ } else if (myCamera.getMode() == CAMERA_MODE_FIRST_PERSON || OculusManager::isConnected()) {
10121012 myAvatar.setDisplayingHead(false);
10131013 myCamera.setUpShift (0.0f);
10141014 myCamera.setDistance (0.0f);
10151015 myCamera.setTightness (100.0f);
10161016 myCamera.setTargetPosition(myAvatar.getHeadPosition());
1017− myCamera.setTargetRotation(myAvatar.getAbsoluteHeadYaw(), myAvatar.getAbsoluteHeadPitch(), 0.0f);
10181017
1018+ if (OculusManager::isConnected()) {
1019+ myCamera.setTargetRotation(myAvatar.getBodyYaw(), -myAvatar.getHeadPitch(), myAvatar.getHeadRoll());
1020+ } else {
1021+ myCamera.setTargetRotation(myAvatar.getAbsoluteHeadYaw(), myAvatar.getAbsoluteHeadPitch(), 0.0f);
1022+ }
10191023 } else if (myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) {
10201024 myAvatar.setDisplayingHead(true);
10211025 myCamera.setUpShift (-0.2f);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t