예제 #1
0
        public void OnDrawRuntimeGizmos(RuntimeGizmoDrawer drawer)
        {
            if (!this.enabled || !this.gameObject.activeInHierarchy)
            {
                return;
            }

            drawer.color = LeapColor.white;

            drawer.DrawPose(this.pose, radius: 0.015f);

            drawer.DrawPose(tabStubPose, radius: 0.010f);
        }
        public void OnDrawRuntimeGizmos(RuntimeGizmoDrawer drawer)
        {
            drawer.color = color;

            if (!_spline.HasValue || (fullPoseSpline && !_qSpline.HasValue))
            {
                return;
            }

            int     resolution = 16;
            float   incr       = 1f / resolution;
            Vector3?lastPos    = null;

            for (float t = 0; t <= 1f; t += incr)
            {
                var pos = _spline.Value.PositionAt(t);
                if (fullPoseSpline)
                {
                    var rot = _qSpline.Value.RotationAt(t);

                    drawer.DrawPose(new Pose(pos, rot), 0.01f);
                }

                if (lastPos.HasValue)
                {
                    drawer.DrawLine(lastPos.Value, pos);
                }

                lastPos = pos;
            }
        }
        public void OnDrawRuntimeGizmos(RuntimeGizmoDrawer drawer)
        {
            if (!this.enabled || !gameObject.activeInHierarchy)
            {
                return;
            }

            drawer.color = gizmoColor;

            foreach (var prevPair in strokePoses.Query().WithPrevious())
            {
                var pose     = prevPair.value;
                var prevPose = prevPair.prev;

                drawer.DrawLine(prevPose.position, pose.position);
            }

            if (drawPoseGizmos)
            {
                foreach (var pose in strokePoses.GetEnumerator())
                {
                    drawer.DrawPose(pose, 0.006f);
                }
            }
        }
예제 #4
0
        public void OnDrawRuntimeGizmos(RuntimeGizmoDrawer drawer)
        {
            if (!this.enabled || !this.gameObject.activeInHierarchy || !drawDebug)
            {
                return;
            }

            drawer.color = LeapColor.purple;

            var poseRadius = 0.004f;

            if (!Application.isPlaying)
            {
                _debugPoseBuffer.Clear();
                _debugPoseBuffer.Add(GetTipPose());
                _debugActivatedBuffer.Clear();
                _debugActivatedBuffer.Add(false);
            }
            for (int i = 0; i < _debugPoseBuffer.Count; i++)
            {
                var pose     = _debugPoseBuffer.Get(i);
                var isActive = _debugActivatedBuffer.Get(i);

                var a = pose.position + pose.rotation * Vector3.right * radius;
                var b = pose.position - pose.rotation * Vector3.right * radius;

                var multiplier = 1f;
                if (isActive)
                {
                    multiplier = 2.5f;
                }

                if (isActive || drawDebugIdlePaths || !Application.isPlaying)
                {
                    drawer.DrawPose(new Pose(a, pose.rotation), poseRadius * multiplier);
                    drawer.DrawPose(new Pose(b, pose.rotation), poseRadius * multiplier);
                }
            }
        }
예제 #5
0
        public void OnDrawRuntimeGizmos(RuntimeGizmoDrawer drawer)
        {
            if (maybePoseSpline.HasValue)
            {
                var spline = maybePoseSpline.Value;

                drawer.color = LeapColor.brown.WithAlpha(0.4f);

                Vector3?prevPos = null;
                int     numSteps = 32;
                int     drawPosePer = 8, counter = 0;
                float   tStep = 1f / numSteps;
                for (float t = 0f; t <= 1f; t += tStep)
                {
                    var pose = spline.PoseAt(t);

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

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

                    prevPos = pose.position;
                    counter++;
                }

                var renderPose = spline.PoseAt(renderPoseAtT);
                var len        = 0.06f;
                var thick      = 0.01f;
                drawer.PushMatrix();
                drawer.matrix = Matrix4x4.TRS(renderPose.position, renderPose.rotation, Vector3.one);
                drawer.color  = Color.red;
                drawer.DrawCube(Vector3.right * ((len / 2f) + (thick / 2f)), new Vector3(len, thick, thick));
                drawer.color = Color.green;
                drawer.DrawCube(Vector3.up * ((len / 2f) + (thick / 2f)), new Vector3(thick, len, thick));
                drawer.color = Color.blue;
                drawer.DrawCube(Vector3.forward * ((len / 2f) + (thick / 2f)), new Vector3(thick, thick, len));
            }
        }