remove some magic from camera

This commit is contained in:
UnknownShadow200 2017-12-09 18:13:09 +11:00
parent 96d01f101f
commit d4f045e2c4
2 changed files with 6 additions and 6 deletions

View File

@ -222,9 +222,9 @@ namespace ClassicalSharp {
Vector3 camPos = player.EyePosition;
camPos.Y += bobbingVer;
double adjHeadY = player.HeadYRadians + Math.PI / 2;
camPos.X += bobbingHor * (float)Math.Sin(adjHeadY);
camPos.Z -= bobbingHor * (float)Math.Cos(adjHeadY);
double headY = player.HeadYRadians;
camPos.X += bobbingHor * (float)Math.Cos(headY);
camPos.Z += bobbingHor * (float)Math.Sin(headY);
return camPos;
}
}

View File

@ -147,9 +147,9 @@ Vector3 FirstPersonCamera_GetCameraPos(Real32 t) {
Vector3 camPos = Entity_GetEyePosition(p);
camPos.Y += Camera_BobbingVer;
Real32 adjHeadY = (p->HeadY * MATH_DEG2RAD) + MATH_PI / 2.0f;
camPos.X += Camera_BobbingHor * Math_Sin(adjHeadY);
camPos.Z -= Camera_BobbingHor * Math_Cos(adjHeadY);
Real32 headY = (p->HeadY * MATH_DEG2RAD);
camPos.X += Camera_BobbingHor * Math_Cos(headY);
camPos.Z += Camera_BobbingHor * Math_Sin(headY);
return camPos;
}