File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
Server/Components/NPCs/NPC Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -1190,13 +1190,23 @@ void NPC::updateAimData(const Vector3& point, bool setAngle)
11901190 if (setAngle)
11911191 {
11921192 auto rotation = getRotation ().ToEuler ();
1193- rotation.z = glm::degrees (glm::atan (unitVec.y , unitVec.x ));
1193+ auto angle = glm::degrees (glm::atan (unitVec.y , unitVec.x )) + 270 .0f ;
1194+ if (angle >= 360 .0f )
1195+ {
1196+ angle -= 360 .0f ;
1197+ }
1198+ else if (angle < 0 .0f )
1199+ {
1200+ angle += 360 .0f ;
1201+ }
1202+
1203+ rotation.z = angle;
11941204 setRotation (rotation);
11951205 }
11961206
11971207 // Set the aim sync data
11981208 aimSync_.AimZ = aimZ;
1199- aimSync_.CamFrontVector = camFronVector ;
1209+ aimSync_.CamFrontVector = unitVec ;
12001210 aimSync_.CamPos = camPosition;
12011211
12021212 // set the flags
You can’t perform that action at this time.
0 commit comments