Beispiel #1
0
        public static dynamic TryGetPathProperty(Track track, string propertyName, float time)
        {
            Property pathProperty = null;

            track?.PathProperties.TryGetValue(propertyName, out pathProperty);
            if (pathProperty == null)
            {
                return(null);
            }

            PointDefinitionInterpolation pointDataInterpolation = (PointDefinitionInterpolation)pathProperty.Value;

            switch (pathProperty.PropertyType)
            {
            case PropertyType.Linear:
                return(pointDataInterpolation.InterpolateLinear(time));

            case PropertyType.Quaternion:
                return(pointDataInterpolation.InterpolateQuaternion(time));

            case PropertyType.Vector3:
                return(pointDataInterpolation.Interpolate(time));

            case PropertyType.Vector4:
                return(pointDataInterpolation.InterpolateVector4(time));

            default:
                return(null);
            }
        }
        public static Vector3?TryGetVector3PathProperty(Track track, string propertyName, float time)
        {
            PointDefinitionInterpolation pointDataInterpolation = GetPathInterpolation(track, propertyName, PropertyType.Vector3);

            if (pointDataInterpolation != null)
            {
                return(pointDataInterpolation.Interpolate(time));
            }

            return(null);
        }