make calcangle actually work
This commit is contained in:
@@ -9,7 +9,7 @@ namespace math {
|
||||
Angle calcAngle(Position sP, Position eP) {
|
||||
Angle returned;
|
||||
returned.x = -(asinf((eP.y - sP.y) / distance(sP, eP)) * 180.0f / M_PI);
|
||||
returned.y = -(atan2f(eP.x - sP.x, eP.z - sP.z) / M_PI * 180.0f + 180.0f);
|
||||
returned.y = (atan2f(eP.x - sP.x,eP.z - sP.z) / M_PI * 180.0f);
|
||||
return returned;
|
||||
}
|
||||
|
||||
|
@@ -36,9 +36,10 @@ public:
|
||||
|
||||
if (cameraMode == CameraMode::THIRD_PERSON) {
|
||||
std::cout << "Calculated Pitch: " << math::calcAngle(position,getPlayer()->position).x << " Calculated Yaw: " << math::calcAngle(position,getPlayer()->position).y << std::endl;
|
||||
//this->position = getPlayer()->cameraPoint(2);
|
||||
this->position = getPlayer()->cameraPoint(2);
|
||||
this->position.y += 0.5;
|
||||
this->angle.x = math::calcAngle(position,getPlayer()->position).x;
|
||||
//this->angle.y = math::calcAngle(position,getPlayer()->position).y;
|
||||
this->angle.y = math::calcAngle(position,getPlayer()->position).y;
|
||||
}
|
||||
|
||||
//if (engine->frameCount == 5000)
|
||||
|
Reference in New Issue
Block a user