enemys always looking at you when you are the target
This commit is contained in:
+17
@@ -14,6 +14,18 @@ float Vec3f::Length()
|
||||
return (float)sqrt(x*x+y*y+z*z);
|
||||
}
|
||||
|
||||
void Vec3f::Normalize()
|
||||
{
|
||||
float length = this->Length();
|
||||
|
||||
if (length != 0)
|
||||
{
|
||||
x = x / length;
|
||||
y = y / length;
|
||||
z = z / length;
|
||||
}
|
||||
}
|
||||
|
||||
float Vec3f::Distance(const Vec3f &other)
|
||||
{
|
||||
return (float)sqrt(pow(other.x - x, 2)+pow(other.y - y, 2)+pow(other.z - z, 2));
|
||||
@@ -42,6 +54,11 @@ Vec3f Vec3f::operator+(const Vec3f & other)
|
||||
return Vec3f(x + other.x, y + other.y, z + other.z);
|
||||
}
|
||||
|
||||
Vec3f Vec3f::operator-(const Vec3f & other)
|
||||
{
|
||||
return Vec3f(x - other.x, y - other.y, z - other.z);
|
||||
}
|
||||
|
||||
Vec3f Vec3f::operator/(float value)
|
||||
{
|
||||
return Vec3f(x / value, y / value, z / value);
|
||||
|
||||
Reference in New Issue
Block a user