Example #1
0
 private static Vector3[] ToWorld(TSSPath path, Vector3[] localPoints)
 {
     Vector3[] worldPoints = new Vector3[localPoints.Length];
     for (int i = 0; i < worldPoints.Length; i++)
     {
         worldPoints[i] = TSSPathBase.ToWorld(path, localPoints[i]);
     }
     return(worldPoints);
 }
Example #2
0
        private void OnEnable()
        {
            path           = (TSSPath)target;
            serializedPath = new SerializedObject(path);
            selection.Clear();
            editModeButtonContent = EditorGUIUtility.IconContent("EditCollider");
            editMode = false;

            foldOutAttachPoints = new AnimBool(false);
            foldOutAttachPoints.valueChanged.AddListener(Repaint);
        }
Example #3
0
        public static List <Vector3> GetDefaultPath(TSSPath path)
        {
            if (path == null || path.item == null || (path.item.values.positions[0] == Vector3.zero && path.item.values.positions[1] == Vector3.zero))
            {
                return(new List <Vector3> {
                    Vector3.left * 200, Vector3.left * 150, Vector3.right * 150, Vector3.right * 200
                });
            }

            Vector3 length = path.item.values.positions[1] - path.item.values.positions[0];

            return(new List <Vector3>
            {
                path.item.values.positions[0],
                path.item.values.positions[0] + length * 0.2f,
                path.item.values.positions[1] - length * 0.2f,
                path.item.values.positions[1]
            });
        }
Example #4
0
 public static Quaternion ToWorld(TSSPath path, Quaternion localRotation)
 {
     return(path.itemWorldRotation * localRotation);
 }
Example #5
0
 public static Quaternion ToLocal(TSSPath path, Quaternion worldRotation)
 {
     return(Quaternion.Inverse(path.itemWorldRotation) * worldRotation);
 }
Example #6
0
 public static Vector3 ToWorld(TSSPath path, Vector3 localPoint)
 {
     return((path.itemWorldRotation * localPoint) + path.itemWorldPosition);
 }
Example #7
0
 public static Vector3 ToLocal(TSSPath path, Vector3 worldPoint)
 {
     return(Quaternion.Inverse(path.itemWorldRotation) * (worldPoint - path.itemWorldPosition));
 }