mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 00:43:30 +02:00
Fix Mixamo avatar clipping in HMD view
This commit is contained in:
parent
4dfc329af2
commit
7afd990e2e
1 changed files with 2 additions and 8 deletions
|
@ -1178,14 +1178,8 @@ void MyAvatar::renderBody(ViewFrustum* renderFrustum, RenderArgs::RenderMode ren
|
|||
} else {
|
||||
float clipDistance = _skeletonModel.getHeadClipDistance();
|
||||
if (OculusManager::isConnected()) {
|
||||
// If avatar is horizontally in front of camera, increase clip distance by the amount it is in front.
|
||||
glm::vec3 cameraToAvatar = _position - cameraPos;
|
||||
cameraToAvatar.y = 0.0f;
|
||||
glm::vec3 cameraLookAt = camera->getOrientation() * glm::vec3(0.0f, 0.0f, -1.0f);
|
||||
float headOffset = glm::dot(cameraLookAt, cameraToAvatar);
|
||||
if (headOffset > 0) {
|
||||
clipDistance += headOffset;
|
||||
}
|
||||
clipDistance = glm::length(getEyePosition()
|
||||
+ camera->getOrientation() * glm::vec3(0.0f, 0.0f, -clipDistance) - cameraPos);
|
||||
}
|
||||
renderFrustum->setNearClip(clipDistance);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue