コード例 #1
0
        private void DrawTangents(Vector3[] segment, float t)
        {
            float   tangentLength = HandleUtility.GetHandleSize(_SplineCreator[_SplineCreator.SelectedPointIndex.BranchIndex].BezierSplineData[_SplineCreator.SelectedPointIndex.HandleIndex]);
            Vector3 startPoint    = Bezier3DUtility.CubicCurveVector3(segment[0], segment[1], segment[2], segment[3], t + 0.1f);
            Vector3 tangent       = Bezier3DUtility.GetTangent(startPoint, Bezier3DUtility.CubicCurveVector3(segment[0], segment[1], segment[2], segment[3], t));

            Handles.color = Color.green;
            Handles.DrawLine(startPoint, startPoint + tangent * tangentLength / 3);
        }
コード例 #2
0
        private void DrawBiNormals(Vector3[] segment, float t)
        {
            float   biNormalLength = HandleUtility.GetHandleSize(_SplineCreator[_SplineCreator.SelectedPointIndex.BranchIndex].BezierSplineData[_SplineCreator.SelectedPointIndex.HandleIndex]);
            Vector3 startPoint     = Bezier3DUtility.CubicCurveVector3(segment[0], segment[1], segment[2], segment[3], t + 0.1f);
            Vector3 tangent        = Bezier3DUtility.GetTangent(startPoint, Bezier3DUtility.CubicCurveVector3(segment[0], segment[1], segment[2], segment[3], t));
            Vector3 biNormal       = Vector3.Cross(Vector3.up, tangent).normalized;

            Handles.color = Color.red;
            Handles.DrawLine(startPoint, startPoint + biNormal * biNormalLength / 3);
        }