Exemple #1
0
        private static void CreatePointsLister()
        {
            GameObject             whereToPut   = CreatePointsLister("Rotation Points Lister");
            QuaternionPoints       points       = whereToPut.AddComponent(typeof(QuaternionPoints)) as QuaternionPoints;
            QuaternionPointsEditor pointsEditor = (QuaternionPointsEditor)CreateEditor((QuaternionPoints)points, typeof(QuaternionPointsEditor));

            pointsEditor.Construct(Color.gray);
            DestroyImmediate(pointsEditor);
            Selection.activeGameObject = points.gameObject;
        }
Exemple #2
0
        //[DrawGizmo(GizmoType.Active | GizmoType.NotInSelectionHierarchy
        //   | GizmoType.InSelectionHierarchy | GizmoType.Pickable, typeof(QuaternionPoints))]
        //static void DrawGizmos(QuaternionPoints points, GizmoType selectionType)
        //{
        //    if (points.gameObject == Selection.activeGameObject)
        //    {
        //        return;
        //    }
        //    if (!points.ShowWayPointsWhenUnselected)
        //    {
        //        return;
        //    }
        //    for (int i = 0; i < points.WaypointsCount; ++i)
        //    {
        //        DrawUnselected(points, i);
        //    }
        //}

        protected static void DrawUnselected(QuaternionPoints point, int index)
        {
            if (!point.DisplayQuaternion)
            {
                return;
            }


            Quaternion currentRotationAtSpline = point.SplineBase.EvaluateOrientation(point.GetWayPoint(index).PathPosition);
            Quaternion localRotation           = point.GetRotation(index);

            Quaternion finalRotation = localRotation * currentRotationAtSpline;
            Vector3    position      = point.GetPositionFromPoint(index);

            ExtDrawGuizmos.DebugArrow(position, finalRotation * Vector3.forward, Color.blue);
            ExtDrawGuizmos.DebugArrow(position, finalRotation * Vector3.right, Color.red);
            ExtDrawGuizmos.DebugArrow(position, finalRotation * Vector3.up, Color.green);

            //Vector3 posInSpline = position + Vector3.down * 0.3f;
            //Vector3 rotationData = localRotation.eulerAngles;
            ////Vector3 position = posInSpline + localPosition;
            //string positionDisplay = (int)rotationData.x + " : " + (int)rotationData.y + " : " + (int)rotationData.z;
            //PointsOnSplineExtensionEditor.DisplayStringInSceneViewFrom3dPosition(posInSpline, positionDisplay, point.ColorWayPoint, 10);
        }