public void MoveTo(Vector3D loc, bool shiftTarget) { Vector3D previousLocation = location; location.SetVector(loc); target.Add(loc.Sub(previousLocation)); }
public void DeriveVectors() { Matrix3D m = world_to_object.Clone(); m.Invert(); double d = target.Sub(location).Length(); if (d <= 0) { d = 10; } location.SetVector(new Vector3D(0, 0, 0)); location.TransformTranspose(m); direction.SetVector(new Vector3D(0, 0, -1)); direction.RotateTranspose(m); direction.Normalize(); up.SetVector(new Vector3D(0, 1, 0)); up.RotateTranspose(m); up.Normalize(); right.SetVector(new Vector3D(1, 0, 0)); right.RotateTranspose(m); right.Normalize(); target = location.clone().Add(direction.clone().Scale(d)); }
public void LookAtTargetPoint() { Vector3D lookDir = target.clone(); lookDir.Sub(location).Normalize(); if (lookDir.IsNotColinear(ref_up)) { up.SetVector(ref_up); } else { up.SetVector(ref_right); } SetLookAt(location, lookDir, up); }