Exemplo n.º 1
0
        // private

        private static AngleLimitSerializer AngleLimitsToSerializer(AngleLimits sourceLimits)
        {
            return(new AngleLimitSerializer
            {
                enabled = sourceLimits.active,
                min = sourceLimits.min,
                max = sourceLimits.max
            });
        }
Exemplo n.º 2
0
        public void DrawGizmos(Color drawColor)
        {
            const int PointCount = 16;

            UnityEditor.Handles.color = drawColor;

            if (ringPoints == null || ringPoints.Length != PointCount)
            {
                ringPoints    = new Vector3[PointCount];
                endRingPoints = new Vector3[PointCount];
            }

            var worldRadius = transform.TransformDirection(radius, 0f, 0f).magnitude;

            var startCapOrigin = transform.position;
            var endCapOrigin   = GetEndCapOriginInWorldSpace();

            AngleLimits.DrawAngleLimit(startCapOrigin, transform.up, transform.forward, -180f, worldRadius, drawColor);
            AngleLimits.DrawAngleLimit(startCapOrigin, transform.up, transform.right, -180f, worldRadius, drawColor);
            AngleLimits.DrawAngleLimit(endCapOrigin, transform.up, transform.forward, 180f, worldRadius, drawColor);
            AngleLimits.DrawAngleLimit(endCapOrigin, transform.up, transform.right, 180f, worldRadius, drawColor);

            GetRingPoints(startCapOrigin, transform.right, transform.forward, worldRadius, ref ringPoints);
            var startToEnd = endCapOrigin - startCapOrigin;

            for (int pointIndex = 0; pointIndex < PointCount; pointIndex++)
            {
                endRingPoints[pointIndex] = ringPoints[pointIndex] + startToEnd;
            }

            for (int pointIndex = 1; pointIndex < PointCount; pointIndex++)
            {
                UnityEditor.Handles.DrawLine(ringPoints[pointIndex - 1], ringPoints[pointIndex]);
                UnityEditor.Handles.DrawLine(endRingPoints[pointIndex - 1], endRingPoints[pointIndex]);
            }

            for (int pointIndex = 0; pointIndex < PointCount; pointIndex++)
            {
                UnityEditor.Handles.DrawLine(ringPoints[pointIndex], endRingPoints[pointIndex]);
            }

            if (colliderDebug != null)
            {
                colliderDebug.DrawGizmos();
            }
        }
Exemplo n.º 3
0
 public void CopyTo(AngleLimits target)
 {
     target.active = active;
     target.min    = min;
     target.max    = max;
 }