diff options
author | Sergeanur <s.anureev@yandex.ua> | 2021-01-04 09:58:12 +0100 |
---|---|---|
committer | Sergeanur <s.anureev@yandex.ua> | 2021-01-04 09:58:12 +0100 |
commit | 1efbd7ead2ffbf3282e2a31f580ff313c684a4cc (patch) | |
tree | 94abfde1742090c29fdc2ae0ba9043088332a545 /src/core | |
parent | dumb (diff) | |
download | re3-1efbd7ead2ffbf3282e2a31f580ff313c684a4cc.tar re3-1efbd7ead2ffbf3282e2a31f580ff313c684a4cc.tar.gz re3-1efbd7ead2ffbf3282e2a31f580ff313c684a4cc.tar.bz2 re3-1efbd7ead2ffbf3282e2a31f580ff313c684a4cc.tar.lz re3-1efbd7ead2ffbf3282e2a31f580ff313c684a4cc.tar.xz re3-1efbd7ead2ffbf3282e2a31f580ff313c684a4cc.tar.zst re3-1efbd7ead2ffbf3282e2a31f580ff313c684a4cc.zip |
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/Cam.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp index 2cf1748c..d4188299 100644 --- a/src/core/Cam.cpp +++ b/src/core/Cam.cpp @@ -2370,8 +2370,10 @@ CCam::Process_M16_1stPerson(const CVector &CameraTarget, float, float, float) Beta += SQR(LookLeftRight/100.0f)*xdir*0.8f/14.0f * FOV/80.0f * CTimer::GetTimeStep(); Alpha += SQR(LookUpDown/150.0f)*ydir*1.0f/14.0f * FOV/80.0f * CTimer::GetTimeStep(); } - while(Beta >= PI) Beta -= 2*PI; - while(Beta < -PI) Beta += 2*PI; + if (!isAttached) { + while(Beta >= TWOPI) Beta -= TWOPI; + while(Beta < 0) Beta += TWOPI; + } if(Alpha > DEGTORAD(60.0f)) Alpha = DEGTORAD(60.0f); else if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f); @@ -2414,13 +2416,14 @@ CCam::Process_M16_1stPerson(const CVector &CameraTarget, float, float, float) } } }else{ - while(Beta < -PI) Beta += 2*PI; - while(Beta >= PI) Beta -= 2*PI; + while(Beta < -PI) Beta += TWOPI; + while(Beta >= PI) Beta -= TWOPI; } mat = TargetPed->m_attachedTo->GetMatrix(); rot.SetRotateX(Alpha); switch(TargetPed->m_attachType){ + case 0: rot.RotateZ(Beta); break; case 1: rot.RotateZ(Beta + HALFPI); break; case 2: rot.RotateZ(Beta + PI); break; case 3: rot.RotateZ(Beta - HALFPI); break; |