mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-06-08 05:24:34 +02:00
moved vector3 to common
- changed distance checks to distance squared - reexported central thanalan navmesh with cell size 0.60, height 0.26, radius 0.5, edge error 1.3, merged region size 30 - todo: main logic loop per zone and move this into proper ai classes
This commit is contained in:
parent
872e56f8f9
commit
c70cf022b7
9 changed files with 145 additions and 121 deletions
74
FFXIVClassic Common Class Lib/Vector3.cs
Normal file
74
FFXIVClassic Common Class Lib/Vector3.cs
Normal file
|
@ -0,0 +1,74 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FFXIVClassic.Common
|
||||
{
|
||||
public class Vector3
|
||||
{
|
||||
public float X;
|
||||
public float Y;
|
||||
public float Z;
|
||||
public static Vector3 Zero = new Vector3();
|
||||
|
||||
public Vector3(float x, float y, float z)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
Z = z;
|
||||
}
|
||||
|
||||
public Vector3()
|
||||
{
|
||||
X = 0.0f;
|
||||
Y = 0.0f;
|
||||
Z = 0.0f;
|
||||
}
|
||||
|
||||
public static Vector3 operator +(Vector3 lhs, Vector3 rhs)
|
||||
{
|
||||
Vector3 newVec = new Vector3(lhs.X, lhs.Y, lhs.Z);
|
||||
newVec.X += rhs.X;
|
||||
newVec.Y += rhs.Y;
|
||||
newVec.Z += rhs.Z;
|
||||
return newVec;
|
||||
}
|
||||
|
||||
public static Vector3 operator -(Vector3 lhs, Vector3 rhs)
|
||||
{
|
||||
return new Vector3(lhs.X - rhs.X, lhs.Y - rhs.Y, lhs.Z - rhs.Z);
|
||||
}
|
||||
|
||||
public static Vector3 operator *(Vector3 lhs, Vector3 rhs)
|
||||
{
|
||||
return new Vector3(lhs.X * rhs.X, lhs.Y * rhs.Y, lhs.Z * rhs.Z);
|
||||
}
|
||||
|
||||
public static Vector3 operator *(float scalar, Vector3 rhs)
|
||||
{
|
||||
return new Vector3(scalar * rhs.X, scalar * rhs.Y, scalar * rhs.Z);
|
||||
}
|
||||
|
||||
public static Vector3 operator /(Vector3 lhs, Vector3 rhs)
|
||||
{
|
||||
return new Vector3(lhs.X - rhs.X, lhs.Y - rhs.Y, lhs.Z - rhs.Z);
|
||||
}
|
||||
|
||||
public float Length()
|
||||
{
|
||||
return (float)Math.Sqrt(this.LengthSquared());
|
||||
}
|
||||
|
||||
public float LengthSquared()
|
||||
{
|
||||
return (this.X * this.X) + (this.Y * this.Y) + (this.Z * this.Z);
|
||||
}
|
||||
|
||||
public static float Dot(Vector3 lhs, Vector3 rhs)
|
||||
{
|
||||
return (lhs.X * rhs.X) + (lhs.Y * rhs.Y) + (lhs.Z * rhs.Z);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue