This commit is contained in:
Claudel-D-Roy 2023-12-06 10:48:04 -05:00
parent 16e9f6aefe
commit 0856f913d2

View File

@ -103,33 +103,39 @@ void RemotePlayer::Render(TextureAtlas& atlas, Shader& shader, Transformation tr
Vector3f v4 = (playerPosition - CrossA * 0.5 * width - CrossB * 0.5 * height);
Vector3f angleRemote = GetDirection();
Vector3f angleCam = Vector3f(v2.z, 0, -v2.x);
Vector3f angleCam = (v1 - v2).Cross(v3 - v2);
angleCam.y = 0;
angleRemote.y = 0;
angleCam.Normalize();
angleRemote.Normalize();
float angle = angleRemote.Dot(angleCam);
angle *= 100;
//angle *= 100;
//angle /= 57.2958;
int index = 0;
Vector3f side = angleRemote.Cross(angleCam);
if (angle >= -0.125 && angle <= 0.125)
//std::cout << "trying: " << trying.y << std::endl;
bool isLeft = side.y > 0;
if (angle >= 0.75 ) //Face //side positif
index = 0;
else if (angle >= 0.125 && angle <= 0.375)
else if (angle >= 0.25 && isLeft) //Frontleft
index = 1;
else if (angle >= 0.375 && angle <= 0.625)
else if (angle >= -0.25 && isLeft) //ProfileLeft
index = 3;
else if (angle >= 0.625 && angle <= 0.875)
else if (angle >= -0.75 && isLeft) //BackLeft
index = 5;
else if (angle >= 0.875 && angle <= -0.875)
else if (angle < -0.75) //Dos //side négatif
index = 7;
else if (angle >= -0.875 && angle <= -0.625)
index = 6;
else if (angle >= -0.625 && angle <= -0.375)
index = 4;
else if (angle >= -0.375 && angle <= -0.125)
else if (angle >= 0.25 && !isLeft) //FrontRight
index = 2;
else if (angle >= -0.25 && !isLeft) //ProfileRight
index = 4;
else if (angle >= -0.75 && !isLeft) //BackRight
index = 6;
std::cout << index << std::endl;
std::cout << "angle: " << angle << std::endl;