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
15// Welcome Aboard!15// Welcome Aboard!
16//16//
17 17
18
19
20#include <math.h>18#include <math.h>
21#include <string.h>19#include <string.h>
22#include <sstream>20#include <sstream>
@@ -421,8 +419,10 @@ void updateAvatar(float deltaTime) { · 398 unmodified lines
421 if (OculusManager::isConnected()) {419 if (OculusManager::isConnected()) {
422 float yaw, pitch, roll;420 float yaw, pitch, roll;
423 OculusManager::getEulerAngles(yaw, pitch, roll);421 OculusManager::getEulerAngles(yaw, pitch, roll);
422
424 myAvatar.setBodyYaw(yaw);423 myAvatar.setBodyYaw(yaw);
425 myAvatar.setRenderPitch(pitch);424 myAvatar.setHeadPitch(-pitch);
425 myAvatar.setHeadRoll(-roll);
426 }426 }
427 427
428 // Get audio loudness data from audio input device428 // Get audio loudness data from audio input device
@@ -1008,14 +1008,18 @@ void display(void) · 579 unmodified lines
1008 myCamera.setTargetPosition(myAvatar.getHeadPosition());1008 myCamera.setTargetPosition(myAvatar.getHeadPosition());
1009 myCamera.setTargetRotation(myAvatar.getBodyYaw() - 180.0f, 0.0f, 0.0f);1009 myCamera.setTargetRotation(myAvatar.getBodyYaw() - 180.0f, 0.0f, 0.0f);
1010 1010
1011 } else if (myCamera.getMode() == CAMERA_MODE_FIRST_PERSON) {1011 } else if (myCamera.getMode() == CAMERA_MODE_FIRST_PERSON || OculusManager::isConnected()) {
1012 myAvatar.setDisplayingHead(false); 1012 myAvatar.setDisplayingHead(false);
1013 myCamera.setUpShift (0.0f);1013 myCamera.setUpShift (0.0f);
1014 myCamera.setDistance (0.0f);1014 myCamera.setDistance (0.0f);
1015 myCamera.setTightness (100.0f); 1015 myCamera.setTightness (100.0f);
1016 myCamera.setTargetPosition(myAvatar.getHeadPosition());1016 myCamera.setTargetPosition(myAvatar.getHeadPosition());
1017 myCamera.setTargetRotation(myAvatar.getAbsoluteHeadYaw(), myAvatar.getAbsoluteHeadPitch(), 0.0f);
1018 1017
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 }
1019 } else if (myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) {1023 } else if (myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) {
1020 myAvatar.setDisplayingHead(true); 1024 myAvatar.setDisplayingHead(true);
1021 myCamera.setUpShift (-0.2f);1025 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