Exemplo n.º 1
0
        private static BGCurvePoint CreatePointBetween(BGCurve curve, BGCurvePointI previousPoint, BGCurvePointI nextPoint, int parts, BGCurvePoint.ControlTypeEnum controlType)
        {
            var newPos  = BGEditorUtility.CalculatePosition(previousPoint, nextPoint, .5f);
            var tangent = BGEditorUtility.CalculateTangent(previousPoint, nextPoint, .5f);

            return(CreatePointBetween(curve, previousPoint, nextPoint, parts, controlType, newPos, tangent));
        }
Exemplo n.º 2
0
        private static BGCurvePoint CreatePointBetween(BGCurve curve, BGCurvePointI previousPoint, BGCurvePointI nextPoint, int parts, BGCurvePoint.ControlTypeEnum controlType)
        {
            var newPos  = BGEditorUtility.CalculatePosition(previousPoint, nextPoint, .5f);
            var tangent = BGEditorUtility.CalculateTangent(previousPoint, nextPoint, .5f);

            var scaledTangent = tangent * DistanceToTangentMultiplier * BGEditorUtility.CalculateDistance(previousPoint, nextPoint, parts);

            return(curve.CreatePointFromLocalPosition(curve.ToLocal(newPos), controlType, curve.ToLocalDirection(-scaledTangent), curve.ToLocalDirection(scaledTangent)));
        }