mirror of
https://github.com/overte-org/overte.git
synced 2025-04-19 16:23:39 +02:00
made the changes as suggested by @hyperlogic
This commit is contained in:
parent
3c6e9378c3
commit
4e8fc08458
2 changed files with 8 additions and 2 deletions
|
@ -58,16 +58,21 @@ float HMDScriptingInterface::getIPD() const {
|
|||
return Application::getInstance()->getActiveDisplayPlugin()->getIPD();
|
||||
}
|
||||
|
||||
glm::mat4 HMDScriptingInterface::getWorldHMDMatrix() const {
|
||||
MyAvatar* myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
|
||||
return myAvatar->getSensorToWorldMatrix() * myAvatar->getHMDSensorMatrix();
|
||||
}
|
||||
|
||||
glm::vec3 HMDScriptingInterface::getPosition() const {
|
||||
if (Application::getInstance()->getActiveDisplayPlugin()->isHmd()) {
|
||||
return glm::vec3(Application::getInstance()->getActiveDisplayPlugin()->getHeadPose()[3]);
|
||||
return extractTranslation(getWorldHMDMatrix());
|
||||
}
|
||||
return glm::vec3();
|
||||
}
|
||||
|
||||
glm::quat HMDScriptingInterface::getOrientation() const {
|
||||
if (Application::getInstance()->getActiveDisplayPlugin()->isHmd()) {
|
||||
return glm::quat_cast(Application::getInstance()->getActiveDisplayPlugin()->getHeadPose());
|
||||
return glm::normalize(glm::quat_cast(getWorldHMDMatrix()));
|
||||
}
|
||||
return glm::quat();
|
||||
}
|
||||
|
|
|
@ -46,6 +46,7 @@ private:
|
|||
|
||||
bool getHUDLookAtPosition3D(glm::vec3& result) const;
|
||||
|
||||
glm::mat4 getWorldHMDMatrix() const;
|
||||
};
|
||||
|
||||
#endif // hifi_HMDScriptingInterface_h
|
||||
|
|
Loading…
Reference in a new issue