mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-05 03:02:01 +02:00
Account for actual eye position in oculus pick ray
This commit is contained in:
parent
efbd74f539
commit
a120e50cc0
1 changed files with 7 additions and 4 deletions
|
@ -428,15 +428,18 @@ void ApplicationOverlay::displayOverlayTexture3DTV(Camera& whichCamera, float as
|
|||
}
|
||||
|
||||
void ApplicationOverlay::computeOculusPickRay(float x, float y, glm::vec3& origin, glm::vec3& direction) const {
|
||||
const MyAvatar* myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
|
||||
const float pitch = (0.5f - y) * MOUSE_PITCH_RANGE;
|
||||
const float yaw = (0.5f - x) * MOUSE_YAW_RANGE;
|
||||
const glm::quat orientation(glm::vec3(pitch, yaw, 0.0f));
|
||||
const glm::vec3 localDirection = orientation * IDENTITY_FRONT;
|
||||
|
||||
//Rotate the UI pick ray by the avatar orientation
|
||||
const MyAvatar* myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
|
||||
origin = myAvatar->getDefaultEyePosition();
|
||||
direction = myAvatar->getOrientation() * localDirection;
|
||||
// Get cursor position
|
||||
const glm::vec3 cursorPos = myAvatar->getDefaultEyePosition() + myAvatar->getOrientation() * localDirection;
|
||||
|
||||
// Ray start where the eye position is and stop where the cursor is
|
||||
origin = myAvatar->getEyePosition();
|
||||
direction = cursorPos - origin;
|
||||
}
|
||||
|
||||
//Caculate the click location using one of the sixense controllers. Scale is not applied
|
||||
|
|
Loading…
Reference in a new issue