forked from teamnwah/openmw-tes3coop
Camera precision fix
This commit is contained in:
parent
ed4863ad7d
commit
5b846ebc71
1 changed files with 5 additions and 5 deletions
|
@ -92,17 +92,17 @@ namespace MWRender
|
||||||
return;
|
return;
|
||||||
const osg::Matrix& worldMat = mats[0];
|
const osg::Matrix& worldMat = mats[0];
|
||||||
|
|
||||||
osg::Vec3 position = worldMat.getTrans();
|
osg::Vec3d position = worldMat.getTrans();
|
||||||
if (!isFirstPerson())
|
if (!isFirstPerson())
|
||||||
position.z() += mHeight;
|
position.z() += mHeight;
|
||||||
|
|
||||||
osg::Quat orient = osg::Quat(getPitch(), osg::Vec3(1,0,0)) * osg::Quat(getYaw(), osg::Vec3(0,0,1));
|
osg::Quat orient = osg::Quat(getPitch(), osg::Vec3d(1,0,0)) * osg::Quat(getYaw(), osg::Vec3d(0,0,1));
|
||||||
|
|
||||||
osg::Vec3 offset = orient * osg::Vec3(0, -mCameraDistance, 0);
|
osg::Vec3d offset = orient * osg::Vec3d(0, -mCameraDistance, 0);
|
||||||
position += offset;
|
position += offset;
|
||||||
|
|
||||||
osg::Vec3 forward = orient * osg::Vec3(0,1,0);
|
osg::Vec3d forward = orient * osg::Vec3d(0,1,0);
|
||||||
osg::Vec3 up = orient * osg::Vec3(0,0,1);
|
osg::Vec3d up = orient * osg::Vec3d(0,0,1);
|
||||||
|
|
||||||
cam->setViewMatrixAsLookAt(position, position + forward, up);
|
cam->setViewMatrixAsLookAt(position, position + forward, up);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue