コード例 #1
0
        public static void DrawPoseSpline(this RuntimeGizmos.RuntimeGizmoDrawer drawer,
                                          HermitePoseSpline spline,
                                          Color?color          = null,
                                          float poseGizmoScale = 0.02f,
                                          int splineResolution = 32,
                                          int drawPosePeriod   = 8,
                                          bool drawPoses       = true,
                                          bool drawSegments    = true)
        {
            if (!color.HasValue)
            {
                color = LeapColor.brown.WithAlpha(0.4f);
            }
            drawer.color = color.Value;

            var tWidth = spline.maxT - spline.minT;

            Vector3?prevPos = null;
            int     counter = 0;
            float   tStep   = (1f / splineResolution) * tWidth;

            for (float t = spline.minT; t <= spline.minT + tWidth; t += tStep)
            {
                var pose = spline.PoseAt(t);

                if (counter % drawPosePeriod == 0 && drawPoses)
                {
                    drawer.DrawPose(pose, 0.02f);
                }

                if (prevPos.HasValue && drawSegments)
                {
                    drawer.DrawLine(prevPos.Value, pose.position);
                }

                prevPos = pose.position;
                counter++;
            }
        }
コード例 #2
0
 public static void DrawRay(this RuntimeGizmos.RuntimeGizmoDrawer drawer,
                            Vector3 position, Vector3 direction)
 {
     drawer.DrawLine(position, position + direction);
 }