Esempio n. 1
0
    float GetCurveCost()
    {
        float lowestCost = float.MaxValue;

        foreach (var curve in _curves)
        {
            float cost = MotionCurve.CompareDistance(_movementControls.fwdCurve, curve, curvePointWeights);
            if (cost < lowestCost)
            {
                lowestCost = cost;
            }
        }

        return(lowestCost);
    }
Esempio n. 2
0
    List <int> GetCurveCandidates(float threshold)
    {
        List <int> curveIDs = new List <int>();

        foreach (var curve in _curves)
        {
            float cost = MotionCurve.CompareDistance(_movementControls.fwdCurve, curve, curvePointWeights,
                                                     positionWeight, forwardWeight, positionToForwardRatio);
            if (cost < threshold)
            {
                curveIDs.Add(curve._uniqueId);
            }
        }

        return(curveIDs);
    }
Esempio n. 3
0
    MotionCurve FindClosestCurve()
    {
        float       lowestCost     = float.MaxValue;
        MotionCurve candidateCurve = new MotionCurve();

        foreach (var curve in _curves)
        {
            float cost = MotionCurve.CompareDistance(_movementControls.fwdCurve, curve, curvePointWeights);
            if (cost < lowestCost)
            {
                lowestCost     = cost;
                candidateCurve = curve;
            }
        }

        return(candidateCurve);
    }