PersistentTrails.Track.sufficientChange C# (CSharp) 메소드

sufficientChange() 개인적인 메소드

private sufficientChange ( Waypoint newNode, RecordingThresholds thresholds ) : bool
newNode Waypoint
thresholds RecordingThresholds
리턴 bool
        private bool sufficientChange(Waypoint newNode, RecordingThresholds thresholds)
        {
            if (waypoints.Count == 0)
                return true; //always add first waypoint

            //SourceVessel.GetSrfVelocity().sqrMagnitude < 0.5f

            if (Quaternion.Angle(waypoints.Last().orientation, newNode.orientation) > thresholds.minOrientationAngleChange )
            {
                //Debug.Log("orientation fulfilled");
                return true;
            }
            if (Vector3.Angle(waypoints.Last().velocity.normalized, newNode.velocity.normalized) > thresholds.minVelocityAngleChange)
            {
                //accept velocity direction changes only if we are actually moving
                if (newNode.velocity.sqrMagnitude > 0.5f)
                {
                    //Debug.Log("velocity fulfilled");
                    return true;
                }
            }
            float relativeSpeedChange = waypoints.Last().velocity.magnitude / newNode.velocity.magnitude;

            if (Mathf.Abs(1 - relativeSpeedChange) > thresholds.minSpeedChangeFactor)
            {
                //Debug.Log("speed fulfilled");
                return true;
            }

            return false;
        }