示例#1
0
 private void OnDrawGizmos()
 {
     if (!SpringManager.onlyShowSelectedBones)
     {
         HandlesUtil.DrawTransform(transform, DrawScale);
     }
 }
示例#2
0
 private void OnDrawGizmosSelected()
 {
     HandlesUtil.DrawTransform(transform, DrawScale);
 }
示例#3
0
        private void OnDrawGizmosSelected()
        {
            // Don't draw us if we're a child of the selection because it's too much visual noise
            if (!UnityEditor.Selection.gameObjects.Contains(gameObject))
            {
                return;
            }

            var drawScale = GetDrawScale();

            if (pivotNode != transform.parent)
            {
                HandlesUtil.DrawTransform(pivotNode, drawScale);
            }
            DrawAngleLimits(drawScale);

            var drawColor = GetDrawColor(true);

            DrawSpringBone(drawColor);

            var ColliderColor = new Color(0.8f, 0.8f, 1f);

            if (sphereColliders != null)
            {
                foreach (var collider in sphereColliders.Where(collider => collider != null))
                {
                    collider.DrawGizmos(ColliderColor);
                }
            }

            if (capsuleColliders != null)
            {
                foreach (var collider in capsuleColliders.Where(collider => collider != null))
                {
                    collider.DrawGizmos(ColliderColor);
                }
            }

            if (panelColliders != null)
            {
                foreach (var collider in panelColliders.Where(collider => collider != null))
                {
                    collider.DrawGizmos(ColliderColor);
                }
            }

            if (lengthLimitTargets != null &&
                lengthLimitTargets.Length > 0)
            {
                DrawLinesToLimitTargets();
                for (int targetIndex = 0; targetIndex < lengthLimitTargets.Length; targetIndex++)
                {
                    var target = lengthLimitTargets[targetIndex];
                    if (target != null)
                    {
                        var targetSpringBone = target.GetComponent <SpringBone>();
                        if (targetSpringBone != null)
                        {
                            var LimitTargetColor = new Color(0.5f, 1f, 0.5f);
                            Gizmos.color = LimitTargetColor;
                            if (SpringManager.showBoneSpheres)
                            {
                                Gizmos.DrawWireSphere(target.position, targetSpringBone.radius);
                            }
                        }
                    }
                }
            }
        }