Example #1
0
        public override void TestDrawGizmos()
        {
            base.TestDrawGizmos();
            // Draw 'grounding' volume

            var radius = capsuleCollider.radius;

            var center = capsuleCollider.center;
            var offset = Mathf.Max(0.0f, capsuleCollider.height * 0.5f - radius);

            var color = new Color(0.5f, 1.0f, 0.6f);

            if (_groundHitInfo.IsSlideSlopeGround(groundLimit))
            {
                color = new Color(0.75f, 0.8f, 0.18f, 1f);
            }
            else
            {
                color = isOnGround ? (isValidGround ? Color.green : Color.blue) : Color.red;
            }

            DebugDraw.DebugWireSphere(ObjAdapter.transform.position + ObjAdapter.transform.rotation * (center - Vector3.up * offset), color, radius * 1.01f);

            // When on ledge, show ledge offset radius and state (solid / empty side)
            var standingOnLedge = isOnLedgeSolidSide || isOnLedgeEmptySide;

            if (standingOnLedge)
            {
                color = isOnLedgeSolidSide
                    ? new Color(0.0f, 1.0f, 0.0f, 0.25f)
                    : new Color(1.0f, 0.0f, 0.0f, 0.25f);

                DebugDraw.DebugCircle(ObjAdapter.transform.position, Vector3.up, color, ledgeOffset);
            }
        }
Example #2
0
        public virtual void TestDrawGizmos()
        {
            if (!isOnGround)
            {
                Logger.InfoFormat("is not on ground!!!");
                if (groundCollider != null)
                {
                    DrawSurfaceNormal();
                }
                return;
            }

            // Ground point

            var color = new Color(0.0f, 1.0f, 0.0f, 0.25f);

            if (!isValidGround)
            {
                color = new Color(0.0f, 0.0f, 1.0f, 0.25f);
            }

            DebugDraw.DebugCircle(groundPoint, surfaceNormal, color, 0.1f);


            // Surface normal
            DrawSurfaceNormal();

            // Step height

            if (!isOnStep)
            {
                return;
            }

            var stepPoint = groundPoint - ObjAdapter.transform.up * stepHeight;

            color = Color.black;
            RuntimeDebugDraw.Draw.DrawRay(groundPoint, stepPoint, color);

            color = new Color(0.0f, 0.0f, 0.0f, 0.25f);
            DebugDraw.DebugCircle(stepPoint, ObjAdapter.transform.up, color, 0.1f);
        }