public LTVectorFloat GetPlayerPos(int index) { LTVectorFloat result = null; IntPtr PlayerObjectPtrAddress = GetPlayerObjectPtrAddress(index); IntPtr PlayerObjectPtr = IntPtr.Add(IntPtr.Zero, BitConverter.ToInt32(ReadMem(PlayerObjectPtrAddress), 0)); if (PlayerObjectPtr != IntPtr.Zero) { result = new LTVectorFloat { X = BitConverter.ToSingle(ReadMem(IntPtr.Add(PlayerObjectPtr, 0xE8)), 0), Y = BitConverter.ToSingle(ReadMem(IntPtr.Add(PlayerObjectPtr, 0xEC)), 0), Z = BitConverter.ToSingle(ReadMem(IntPtr.Add(PlayerObjectPtr, 0xF0)), 0) }; } return(result); }
public float DistSqr(LTVectorFloat b) => Subtract(b).LengthSqr();
public float Dist(LTVectorFloat b) => Subtract(b).Length();
public float Dot(LTVectorFloat b) => X * b.X + Y * b.Y + Z * b.Z;
public LTVectorFloat Subtract(LTVectorFloat b) => new LTVectorFloat(X - b.X, Y - b.Y, Z - b.Z);
public LTVectorFloat Cross(LTVectorFloat b) => new LTVectorFloat(Y * b.Z - Z * b.Y, Z * b.X - X * b.Z, X * b.Y - Y * b.X);