Exemplo n.º 1
0
        public override void DrawGizmos()
        {
            base.DrawGizmos();

            if (probe == null)
            {
                return;
            }

            var up            = probe.up;
            var forward       = probe.forward;
            var right         = probe.right;
            var groundContact = probe.position;

            var center = groundContact + (radius * up);

            var degrees  = distance.Value / strideLength.Value * 180;
            var rotation = Quaternion.AngleAxis(degrees, right);

            var extents = (
                contact : groundContact,
                center + (radius * up),
                center - radius * forward,
                center + radius * forward
                );
            var rotated = (
                extents.Item1.RotatePointAroundPivot(center, rotation),
                extents.Item2.RotatePointAroundPivot(center, rotation),
                extents.Item3.RotatePointAroundPivot(center, rotation),
                extents.Item4.RotatePointAroundPivot(center, rotation)
                );

            Gizmos.DrawLine(rotated.Item1, rotated.Item2);
            GreatGizmos.DrawLine(rotated.Item3, rotated.Item4, LineStyle.Dashed);
        }
Exemplo n.º 2
0
        public override void DrawGizmos()
        {
            base.DrawGizmos();

            if (_animatable == null)
            {
                return;
            }

            var t             = _animatable.transform;
            var up            = t.up;
            var forward       = t.forward;
            var right         = t.right;
            var groundContact = t.position;

            var radius = _walkCycleLength / (2 * Mathf.PI);
            var center = groundContact + (radius * up);

            var degrees  = _walkCyclePercent * 180;
            var rotation = Quaternion.AngleAxis(degrees, right);

            var extents = (
                contact : groundContact,
                center + (radius * up),
                center - radius * forward,
                center + radius * forward
                );
            var rotated = (
                extents.Item1.RotatePointAroundPivot(center, rotation),
                extents.Item2.RotatePointAroundPivot(center, rotation),
                extents.Item3.RotatePointAroundPivot(center, rotation),
                extents.Item4.RotatePointAroundPivot(center, rotation)
                );

            Gizmos.DrawLine(rotated.Item1, rotated.Item2);
            GreatGizmos.DrawLine(rotated.Item3, rotated.Item4, LineStyle.Dashed);
        }