/// <summary> /// Initiate movement of the model to target position. /// </summary> /// <param name="target">Target position.</param> public virtual void MoveTo(Vector3 target) { target = NormalizeEndPosition(MathExtra.VectorOnXZAxis(target)); // if target is same as position, do not move and rotate, if we move it will rotate character 180 degrees if (MathExtra.VectorOnXZAxis(_position) == target) { return; } _endPosition = target; TurnToTarget(target); _isMovingPrevStatus = _isMoving; _isMoving = true; }
/// <summary> /// Initiate movement of the model to target position. /// </summary> /// <param name="x">Target X value.</param> /// <param name="z">Target Z value.</param> public virtual void MoveTo(float x, float z) { Vector3 target = MathExtra.VectorOnXZAxis(new Vector3(x, 0, z)); MoveTo(target); }