Beispiel #1
0
    void OnDrawGizmos()
    {
        frontTransform = transform.FindChild("front");
        backTransform  = transform.FindChild("back");

        Gizmos.color = new Vector4(0, 0, 1, 1);
        Gizmos.DrawWireSphere(transform.position, gizmoSize);

        Gizmos.color = new Vector4(0.7f, 0.7f, 1, 1);
        //Gizmos.DrawLine(transform.position, transform.position + transform.forward * frontWeight);
        //Gizmos.DrawLine(transform.position, transform.position - transform.forward * backWeight);

        Gizmos.DrawLine(transform.position, frontTransform.position);
        Gizmos.DrawLine(transform.position, backTransform.position);

        //Gizmos.DrawWireSphere(transform.position + transform.forward * frontWeight, gizmoSize / 2);
        //Gizmos.DrawWireSphere(transform.position - transform.forward * backWeight, gizmoSize / 2);

        DebugExtension.DrawArrow(transform.position, transform.forward / 2, Color.cyan);

        // up and right indicators
        Gizmos.color = new Vector4(1, 0, 0, 1);
        Gizmos.DrawLine(transform.position, transform.position + transform.right * 3);
        Gizmos.color = new Vector4(0, 1, 0, 1);
        Gizmos.DrawLine(transform.position, transform.position + transform.up * 3);
    }
Beispiel #2
0
 private void OnDrawGizmosSelected()
 {
     if (_spawn != null)
     {
         DebugExtension.DrawArrow(_spawn.position, _spawn.forward * 0.2f, Color.red);
     }
 }
Beispiel #3
0
    void OnDrawGizmos()
    {
        DebugExtension.DrawCircle(transform.position, transform.forward, Color.white, mRadius);

        DebugExtension.DrawCircle(transform.position + transform.right * mRadius, transform.up, Color.white, mThickness / 2);
        DebugExtension.DrawCircle(transform.position - transform.right * mRadius, transform.up, Color.white, mThickness / 2);

        DebugExtension.DrawCircle(transform.position + transform.up * mRadius, transform.right, Color.white, mThickness / 2);
        DebugExtension.DrawCircle(transform.position - transform.up * mRadius, transform.right, Color.white, mThickness / 2);

        Vector3 pos = transform.position + (transform.up * mRadius + transform.right * mRadius) / Mathf.Sqrt(2);

        DebugExtension.DrawCircle(pos, transform.up - transform.right, Color.white, mThickness / 2);

        pos = transform.position - (transform.up * mRadius + transform.right * mRadius) / Mathf.Sqrt(2);
        DebugExtension.DrawCircle(pos, transform.up - transform.right, Color.white, mThickness / 2);

        pos = transform.position + (transform.up * mRadius - transform.right * mRadius) / Mathf.Sqrt(2);
        DebugExtension.DrawCircle(pos, transform.up + transform.right, Color.white, mThickness / 2);

        pos = transform.position - (transform.up * mRadius - transform.right * mRadius) / Mathf.Sqrt(2);
        DebugExtension.DrawCircle(pos, transform.up + transform.right, Color.white, mThickness / 2);

        DebugExtension.DrawArrow(transform.position, transform.forward, Color.white);
    }
Beispiel #4
0
    void OnDrawGizmos()
    {
        var halfPlaneSizeX = transform.right * planeSize.x * 0.5f;
        var halfPlaneSizeY = transform.forward * planeSize.y * 0.5f;

        Debug.DrawLine(transform.position - halfPlaneSizeX - halfPlaneSizeY, transform.position + halfPlaneSizeX - halfPlaneSizeY, Color.green);
        Debug.DrawLine(transform.position + halfPlaneSizeX - halfPlaneSizeY, transform.position + halfPlaneSizeX + halfPlaneSizeY, Color.green);
        Debug.DrawLine(transform.position + halfPlaneSizeX + halfPlaneSizeY, transform.position - halfPlaneSizeX + halfPlaneSizeY, Color.green);
        Debug.DrawLine(transform.position - halfPlaneSizeX + halfPlaneSizeY, transform.position - halfPlaneSizeX - halfPlaneSizeY, Color.green);

        foreach (var particle in debugParticles)
        {
            if (particle.flags != 0)
            {
                DebugExtension.DebugCircle(new Vector3(particle.x, 0, particle.y), Color.magenta, particleRadius);
                DebugExtension.DrawArrow(new Vector3(particle.x, 0, particle.y), new Vector3(particle.dx, 0, particle.dy), Color.magenta);
                var currentPosition = particle.GetPosition(currentTime);
                DebugExtension.DebugCircle(new Vector3(currentPosition.x, 0, currentPosition.y), Color.blue, particleRadius);

                var proj = Project(new Vector3(currentPosition.x, 0, currentPosition.y));
                Debug.LogFormat("{0} {1}", proj.x * textureSize, proj.y * textureSize);

                break;
            }
        }
    }
Beispiel #5
0
    public void DebugDrawVelocityGrid()
    {
        if (mVelGrid != null)
        {
            Vector3 cellExtent = mVelGrid.GetCellExtent();
            Vector3 gridExtent = mVelGrid.GetExtent();
            Vector3 numCells   = new Vector3(mVelGrid.GetNumCells(0), mVelGrid.GetNumCells(1), mVelGrid.GetNumCells(2));
            Vector3 gridOrigin = mVelGrid.GetMinCorner();

            for (int i = 0; i < numCells.x; ++i)
            {
                for (int j = 0; j < numCells.y; ++j)
                {
                    for (int k = 0; k < numCells.z; ++k)
                    {
                        uint[]  indices = { (uint)i, (uint)j, (uint)k };
                        uint    offset  = mVelGrid.OffsetFromIndices(indices);
                        Vector3 center  = mVelGrid.PositionFromIndices(indices) + cellExtent / 2;
                        if (mVelGrid[offset].v.magnitude == 0)
                        {
                            break;
                        }

                        Color color = new Vector4(0.8f, 0.8f, 1, 1);
                        DebugExtension.DrawArrow(center, mVelGrid[offset].v / 8, color);
                    }
                }
            }
        }
    }
Beispiel #6
0
    protected override void OnDrawGizmos()
    {
        base.OnDrawGizmos();
        Vector3 aCircleCenter = transform.rotation * new Vector3(0.0f, 0.0f, mWanderDistance) + transform.position;

        DebugExtension.DrawCircle(aCircleCenter, Vector3.up, Color.green, mWanderRadius);
        Debug.DrawLine(transform.position, mTarget, Color.yellow);
        DebugExtension.DrawArrow(transform.position, transform.forward * mWanderDistance, Color.grey);
    }
Beispiel #7
0
 private void OnDrawGizmos()
 {
     if (_isDebug == false)
     {
         return;
     }
     if (Application.isPlaying == false)
     {
         _initialPosition = transform.position;
     }
     DebugExtension.DrawArrow(_initialPosition + transform.forward * _negativeOffset, Vector3.up * 3, _debugColor);
     DebugExtension.DrawArrow(_initialPosition + transform.forward * _positiveOffset, Vector3.up * 3, _debugColor);
 }
Beispiel #8
0
 private void OnDrawGizmos()
 {
     if (_isDebug == false)
     {
         return;
     }
     if (_areaRadius > 0)
     {
         DebugExtension.DrawCylinder(transform.position, transform.position + new Vector3(0, 1, 0), _debugColor, _areaRadius);
     }
     else
     {
         DebugExtension.DrawArrow(transform.position, new Vector3(0, 1, 0), _debugColor);
     }
 }
Beispiel #9
0
    void OnDrawGizmos()
    {
        var halfPlaneSize = planeSize * 0.5f;

        Debug.DrawLine(new Vector3(-halfPlaneSize.x, 0, -halfPlaneSize.y), new Vector3(+halfPlaneSize.x, 0, -halfPlaneSize.y), Color.green);
        Debug.DrawLine(new Vector3(+halfPlaneSize.x, 0, -halfPlaneSize.y), new Vector3(+halfPlaneSize.x, 0, +halfPlaneSize.y), Color.green);
        Debug.DrawLine(new Vector3(+halfPlaneSize.x, 0, +halfPlaneSize.y), new Vector3(-halfPlaneSize.x, 0, +halfPlaneSize.y), Color.green);
        Debug.DrawLine(new Vector3(-halfPlaneSize.x, 0, +halfPlaneSize.y), new Vector3(-halfPlaneSize.x, 0, -halfPlaneSize.y), Color.green);
        foreach (var particle in particles)
        {
            DebugExtension.DebugCircle(new Vector3(particle.birthPosition.x, 0, particle.birthPosition.y), new Color(1, 0, 1, 0.25f), particleRadius);
            DebugExtension.DrawArrow(new Vector3(particle.birthPosition.x, 0, particle.birthPosition.y), new Vector3(particle.direction.x, 0, particle.direction.y), new Color(1, 0, 1, 0.25f));
            var currentPosition = particle.GetPosition(currentTime);
            DebugExtension.DebugCircle(new Vector3(currentPosition.x, 0, currentPosition.y), new Color(0, 0, 1, 0.25f), particleRadius);
        }
    }
Beispiel #10
0
    public void OnDebugRender()
    {
        if (m_vHeading.magnitude > 0)
        {
            DebugExtension.DrawArrow(m_vPos, m_vHeading * m_fBoundingRadius, Color.blue);
        }

        if (m_vSide.magnitude > 0)
        {
            DebugExtension.DrawArrow(m_vPos, m_vSide * m_fBoundingRadius, Color.red);
        }

        Gizmos.color = Color.black;

        DebugExtension.DrawCircle(m_vPos, m_fBoundingRadius);
    }
Beispiel #11
0
    private void OnDrawGizmosSelected()
    {
        if (_animationObject == null)
        {
            return;
        }

        Vector3   pointA = _startingPosition;
        Vector3   pointB = _endingPosition;
        Transform parent = _animationObject.parent;

        if (parent == null)
        {
            parent = _animationObject;
        }

        if (_motionType == MotionType.Relative)
        {
            if (_space == Space.Self)
            {
                pointA = parent.TransformPoint(_startingPosition);
                pointB = parent.TransformPoint(_startingPosition + _endingPosition);
            }
            else if (_space == Space.World)
            {
                pointA = _animationObject.position + _startingPosition;
                pointB = _animationObject.position + _endingPosition;
            }
        }
        else if (_motionType == MotionType.Absolute)
        {
            if (_space == Space.Self)
            {
                pointA = parent.TransformPoint(pointA);
                pointB = parent.TransformPoint(pointB);
            }
        }

        Gizmos.color = Color.magenta;
        Gizmos.DrawLine(pointA, pointB);
        DebugExtension.DrawArrow(pointB - (pointB - pointA).normalized * 4, (pointB - pointA).normalized * 4, Gizmos.color);
    }
Beispiel #12
0
 void OnDrawGizmos()
 {
     if (debugPoint)
     {
         DebugExtension.DrawPoint(debugPoint_Position, debugPoint_Color, debugPoint_Scale);
     }
     if (debugBounds)
     {
         DebugExtension.DrawBounds(new Bounds(new Vector3(10, 0, 0), debugBounds_Size), debugBounds_Color);
     }
     if (debugCircle)
     {
         DebugExtension.DrawCircle(new Vector3(20, 0, 0), debugCircle_Up, debugCircle_Color, debugCircle_Radius);
     }
     if (debugWireSphere)
     {
         Gizmos.color = debugWireSphere_Color;
         Gizmos.DrawWireSphere(new Vector3(30, 0, 0), debugWireSphere_Radius);
     }
     if (debugCylinder)
     {
         DebugExtension.DrawCylinder(new Vector3(40, 0, 0), debugCylinder_End, debugCylinder_Color, debugCylinder_Radius);
     }
     if (debugCone)
     {
         DebugExtension.DrawCone(new Vector3(50, 0, 0), debugCone_Direction, debugCone_Color, debugCone_Angle);
     }
     if (debugArrow)
     {
         DebugExtension.DrawArrow(new Vector3(60, 0, 0), debugArrow_Direction, debugArrow_Color);
     }
     if (debugCapsule)
     {
         DebugExtension.DrawCapsule(new Vector3(70, 0, 0), debugCapsule_End, debugCapsule_Color, debugCapsule_Radius);
     }
     if (debugCapsule)
     {
         DebugExtension.DrawCapsule(new Vector3(80, 0, 0), 20, debugCapsule_Radius);
     }
 }