ForGizmo() public static method

public static ForGizmo ( Vector3 pos, Vector3 direction, Color color, float arrowHeadLength = 0.25f, float arrowHeadAngle = 20.0f ) : void
pos Vector3
direction Vector3
color Color
arrowHeadLength float
arrowHeadAngle float
return void
Esempio n. 1
0
        public void OnDrawGizmos()
        {
            Gizmos.color = Color.white;
            Gizmos.DrawLine(MountPoint.position, DismountPoint.position);
            Gizmos.color = Colors.Alpha(Color.yellow, 0.2f);
            Gizmos.DrawSphere(MountPoint.position, 1f);
            Gizmos.DrawSphere(DismountPoint.position, 1f);
            Gizmos.color = Color.yellow;
            DrawArrow.ForGizmo(MountPoint.position + MountPoint.forward, -MountPoint.forward, 0.25f, 15f);
            DrawArrow.ForGizmo(DismountPoint.position, -DismountPoint.forward, 0.25f, 15f);
            Gizmos.color = Colors.Alpha(Color.red, 0.2f);
            DrawArrow.ForGizmo(DismountPoint.position - DismountPoint.forward, Vector3.down, 0.25f);
            Gizmos.DrawSphere(DismountPoint.position - DismountPoint.forward, 0.5f);
            Gizmos.DrawSphere(MountPoint.position + DismountPoint.forward, 0.5f);
            UnityEditor.Handles.color = Color.red;
            UnityEditor.Handles.DrawWireDisc(DismountPoint.position - DismountPoint.forward, Vector3.up, 0.5f);
            UnityEditor.Handles.color = Color.red;
            UnityEditor.Handles.DrawWireDisc(MountPoint.position + DismountPoint.forward, Vector3.up, 0.5f);

            if (Climbing)
            {
                Gizmos.color = Color.green;
                Gizmos.DrawSphere(climbLookTarget.position, 0.25f);
                DrawArrow.ForGizmo(climbLookTarget.position, climbLookTarget.forward, 0.25f);
            }
        }
Esempio n. 2
0
        private void OnDrawGizmosSelected()
        {
            // gravity opposite direction
            if (_enemyRigidbody != null)
            {
                Gizmos.color = Color.cyan;
                DrawArrow.ForGizmo(transform.position, _enemyRigidbody.velocity);
            }

            var targetNormal = (transform.position - Planet.position).normalized;
            var capsuleB     = Quaternion.FromToRotation(Vector3.up, targetNormal) *
                               CapsuleBegin;
            var capsuleE = Quaternion.FromToRotation(Vector3.up, targetNormal) *
                           CapsuleEnd;

            // bomb player detection range
            DebugExtension.DrawCapsule(transform.position + capsuleB,
                                       transform.position + capsuleE,
                                       _isPlayerInRange ? Color.red : Color.gray, CapsuleRadius);

            if (!_isPlayerInRange)
            {
                return;
            }

            Gizmos.color = Color.red;
            Gizmos.DrawLine(transform.position,
                            transform.position +
                            (Player.position - transform.position).normalized *
                            _distanceToPlayer);
        }
        private void OnDrawGizmosSelected()
        {
            // recalculates trajectorie on current parameters - cpu heavy
            if (!Application.isPlaying)
            {
                ComputeTrajectory();
            }

            // draw initial velocity vector
            var maxScale = Mathf.Max(transform.lossyScale.x,
                                     transform.lossyScale.y, transform.lossyScale.z);

            Gizmos.color = Color.blue;
            Gizmos.DrawLine(transform.position,
                            transform.position + StartingVelocity * maxScale);
            DrawArrow.ForGizmo(
                transform.position + StartingVelocity * maxScale,
                StartingVelocity * maxScale);

            Gizmos.color = Color.magenta;
            // draws current simulation orbit points
            for (var i = 0; i < _orbitPoints.Count - 1; i++)
            {
                Gizmos.DrawLine(_orbitPoints[i], _orbitPoints[i + 1]);
            }
        }
Esempio n. 4
0
        public void OnDrawGizmos()
        {
            Vector3 lastPosition    = Vector3.zero;
            Vector3 currentPosition = Vector3.zero;

            Gizmos.color = Color.blue;
            for (int i = 0; i < Props.Nodes.Count; i++)
            {
                if (i == 0)
                {
                    lastPosition    = Props.Nodes [i];
                    lastPosition.y += Props.BaseHeight;
                }
                else
                {
                    currentPosition    = Props.Nodes [i];
                    currentPosition.y += Props.BaseHeight;
                    Gizmos.DrawLine(lastPosition, currentPosition);
                    lastPosition = currentPosition;
                }
            }

            if (FlowCollider != null && FlowForce != Vector3.zero)
            {
                Gizmos.color = Color.red;
                DrawArrow.ForGizmo(FlowCollider.center, FlowForce, 2f);
            }
        }
 private void OnDrawGizmos()
 {
     Gizmos.color = Color.red;
     DrawArrow.ForGizmo(transform.position, _hitDown.normal);
     Gizmos.color = Color.red;
     DrawArrow.ForGizmo(transform.position, _hitUp.normal);
 }
Esempio n. 6
0
        public void OnDrawGizmos()
        {
            if (worlditem == null || worlditem.tr == null)
            {
                return;
            }

            SawPlayerGizmo = Mathf.Lerp(SawPlayerGizmo, 0.15f, (float)WorldClock.ARTDeltaTime);

            Gizmos.color = Colors.Alpha(Color.green, SawPlayerGizmo);
            float      totalFOV          = State.FieldOfView * 120f;
            float      rayRange          = AwarenessDistanceTypeToVisibleDistance(State.AwarenessDistance);
            float      halfFOV           = totalFOV / 2.0f;
            Quaternion leftRayRotation   = Quaternion.AngleAxis(-halfFOV, Vector3.up);
            Quaternion rightRayRotation  = Quaternion.AngleAxis(halfFOV, Vector3.up);
            Vector3    leftRayDirection  = leftRayRotation * worlditem.tr.forward;
            Vector3    rightRayDirection = rightRayRotation * worlditem.tr.forward;

            Gizmos.DrawRay(worlditem.tr.position, leftRayDirection * rayRange);
            Gizmos.DrawRay(worlditem.tr.position, rightRayDirection * rayRange);

            Gizmos.color      = Colors.Alpha(Color.red, SawPlayerGizmo);
            totalFOV          = totalFOV * Player.Local.FieldOfViewMultiplier;
            rayRange          = rayRange * Player.Local.AwarenessDistanceMultiplier;
            halfFOV           = totalFOV / 2f;
            leftRayRotation   = Quaternion.AngleAxis(-halfFOV, Vector3.up);
            rightRayRotation  = Quaternion.AngleAxis(halfFOV, Vector3.up);
            leftRayDirection  = leftRayRotation * worlditem.tr.forward;
            rightRayDirection = rightRayRotation * worlditem.tr.forward;
            Gizmos.DrawRay(worlditem.tr.position, leftRayDirection * rayRange);
            Gizmos.DrawRay(worlditem.tr.position, rightRayDirection * rayRange);

            Gizmos.color = Color.cyan;
            DrawArrow.ForGizmo(worlditem.tr.position, worlditem.tr.forward, 0.25f, 20f);
        }
Esempio n. 7
0
 public void DrawAxis(Vector3 origin, Vector3 direction, float length = 1)
 {
     if (draw)
     {
         DrawArrow.ForGizmo(origin, direction * length, drawColor);
         DrawArrow.ForGizmo(origin, direction * length, drawColor);
     }
 }
Esempio n. 8
0
 public void OnDrawGizmos()
 {
     Gizmos.color = Color.blue;
     DrawArrow.ForGizmo(WaterfallTop.position, WaterfallTop.forward * 2);
     DrawArrow.ForGizmo(WaterfallTop.position + WaterfallTop.forward, -WaterfallBottom.up * 2);
     DrawArrow.ForGizmo(WaterfallBottom.position - WaterfallBottom.forward + WaterfallBottom.up, -WaterfallBottom.up * 2);
     DrawArrow.ForGizmo(WaterfallBottom.position, WaterfallBottom.forward * 2);
 }
    static void DrawHandles(StateTransitionPoint stateTransitionPoint, GizmoType gizmoType)
    {
        if (stateTransitionPoint.drawText)
        {
            GUIStyle stateStyle = new GUIStyle();
            stateStyle.normal.textColor = Color.yellow;
            stateStyle.alignment        = TextAnchor.MiddleCenter;
            stateStyle.contentOffset    = new Vector2(0, -7);

            GUIStyle indexStyle = new GUIStyle();
            indexStyle.normal.textColor = Color.yellow;
            indexStyle.alignment        = TextAnchor.LowerRight;
            indexStyle.contentOffset    = new Vector2(12, 3);

            stateStyle.fontSize = 20;

            Handles.Label(stateTransitionPoint.transform.position, StateManager.StateToString(stateTransitionPoint.TargetState)[0].ToString(), stateStyle);
            Handles.Label(stateTransitionPoint.transform.position, stateTransitionPoint.index.ToString(), indexStyle);

            if (stateTransitionPoint.EarthHex)
            {
                Gizmos.color = new Color(1.0f, 0.2f, 0.2f, 1.0f); // brown
                DrawArrow.ForGizmo(stateTransitionPoint.transform.position, stateTransitionPoint.EarthHex.transform.position - stateTransitionPoint.transform.position);
            }

            if (stateTransitionPoint.LightningHex)
            {
                Gizmos.color = new Color(0.0f, 0.0f, 1.0f, 1.0f); // blue
                DrawArrow.ForGizmo(stateTransitionPoint.transform.position, stateTransitionPoint.LightningHex.transform.position - stateTransitionPoint.transform.position);
            }

            if (stateTransitionPoint.CheckPoint)
            {
                Gizmos.color = new Color(0.93f, 0.58f, 0.04f, 1.0f); // yellow
                DrawArrow.ForGizmo(stateTransitionPoint.transform.position, stateTransitionPoint.CheckPoint.transform.position - stateTransitionPoint.transform.position);
            }

            if (stateTransitionPoint.cameraTargetHex)
            {
                Gizmos.color = Color.grey;
                DrawArrow.ForGizmo(stateTransitionPoint.transform.position, stateTransitionPoint.cameraTargetHex.transform.position - stateTransitionPoint.transform.position);
            }

            // Draw Bounds if it is selected
            if (Selection.transforms.Length > 0 && (Selection.transforms[0] == stateTransitionPoint.gameObject.transform.parent || Selection.transforms[0] == stateTransitionPoint.gameObject.transform))
            {
                Gizmos.color = Color.magenta;
                Vector3 centre = Vector3.zero;
                centre.x = (stateTransitionPoint.camBounds.x + stateTransitionPoint.camBounds.y) / 2;
                centre.z = (stateTransitionPoint.camBounds.z + stateTransitionPoint.camBounds.w) / 2;
                Vector3 size = Vector3.zero;
                size.x = (stateTransitionPoint.camBounds.x - stateTransitionPoint.camBounds.y);
                size.y = 5;
                size.z = (stateTransitionPoint.camBounds.z - stateTransitionPoint.camBounds.w);
                Gizmos.DrawWireCube(centre, size);
            }
        }
    }
Esempio n. 10
0
    public void Render(Station from, Station to)
    {
        Vector3 fromPosition = from.transform.position;
        Vector3 toPosition   = to.transform.position;
        Vector3 direction    = toPosition - fromPosition;
        float   headLength   = 20f * GameMapSizeFactor.GetFactorForCurrentMapRelativeToFirstMap();

        DrawArrow.ForGizmo(fromPosition, direction, headLength);
    }
Esempio n. 11
0
    //=====================================================

    void OnDrawGizmos()
    {
        // Allow for rotations
        Gizmos.DrawIcon(_thisTransform.position + new Vector3(0.0f, 0.3f, 0.0f), "TickIcon.png", false);

        Gizmos.color = GetGizmoColor();
        Gizmos.DrawSphere(_thisTransform.position, 0.1f);

        DrawArrow.ForGizmo(_thisTransform.position + new Vector3(0.0f, 0.05f, 0.0f), _thisTransform.forward, 0.4f);
    }
    private void OnDrawGizmos()
    {
        if (draw_gizmo)
        {
            Gizmos.DrawWireCube(transform.position, new Vector3(grid_world_size.x, 1, grid_world_size.y));

            if (nodes != null)
            {
                //nodes.player = player;

                foreach (Node node in nodes)
                {
                    if (!draw_vector_gizmo)
                    {
                        Gizmos.color = node.IsWalkable() ? Color.white : (node.IsPlayer() ? Color.blue : (node.IsZombie() ? Color.green : Color.red));
                        if (node.is_path)
                        {
                            Gizmos.color = Color.black;
                        }
                        Gizmos.DrawCube(node.world_pos, Vector3.one * node_length / 1.8f);
                    }
                    else
                    {
                        Gizmos.color = Color.red;
                        DrawArrow.ForGizmo(node.world_pos, node.flow_field);
                    }
                }

                /*if (randon)
                 * {
                 *  System.Random rnd = new System.Random();
                 *  randon = false;
                 *  r1 = rnd.Next(0, 99);
                 *  r2 = rnd.Next(0, 99);
                 *  r3 = rnd.Next(0, 99);
                 *  r4 = rnd.Next(0, 99);
                 * }
                 *  Node node1 = nodes.GetNode(r1, r2);
                 *  Node node2 = nodes.GetNode(r3, r4);
                 *  Gizmos.color = Color.blue;
                 *  Gizmos.DrawCube(node1.world_pos, Vector3.one * node_length / 1.8f);
                 *  Gizmos.DrawCube(node2.world_pos, Vector3.one * node_length / 1.8f);
                 *
                 *  Gizmos.color = Color.magenta;
                 *  DrawPath(r1, r2, r3, r4);
                 *
                 *  Gizmos.color = Color.green;
                 *  Gizmos.DrawCube(node1.world_pos, Vector3.one * node_length / 1.8f);
                 *  Gizmos.DrawCube(node2.world_pos, Vector3.one * node_length / 1.8f);
                 *
                 */
                //Debug.Log(nodes.IsDirectPath(21, 20, 20, 35));
            }
        }
    }
 void OnDrawGizmos()
 {
     if (!Application.isPlaying)
     {
         DrawArrow.ForGizmo(transform.position, initalVelocity, Color.black);
     }
     else
     {
         DrawArrow.ForGizmo(transform.position, rb.velocity, Color.black);
     }
 }
Esempio n. 14
0
    //=====================================================

    void OnDrawGizmos()
    {
        if (_obstacleBody == null)
        {
            return;
        }

        // Allow for rotations
        Gizmos.color = Color.white;
        DrawArrow.ForGizmo(_obstacleBody.position, _thisTransform.right, 0.4f);
        DrawArrow.ForGizmo(_obstacleBody.position, -_thisTransform.right, 0.4f);
    }
Esempio n. 15
0
 public static void randomStar(Vector3 center, Color color)
 {
     //special: refuse to draw at 0,0.
     if (center == Vector3.zero)
     {
         return;
     }
     for (int i = 0; i < 2; i++)
     {
         DrawArrow.ForGizmo(center, UnityEngine.Random.onUnitSphere * 1, color, false, 0.1f, 30.0f);
     }
 }
Esempio n. 16
0
    private void OnDrawGizmos()
    {
        var currentPosition = transform.position;
        var direction       = transform.right;

        direction = Quaternion.AngleAxis(fallAngle, transform.up) * direction;
        for (int i = 0; i < debugArrowCount; i++)
        {
            var deltaY = transform.up * (debugHeight / debugArrowCount);
            DrawArrow.ForGizmo(currentPosition += deltaY, direction * debugArrowLength);
        }
    }
Esempio n. 17
0
    //=====================================================

    void OnDrawGizmos()
    {
        // Allow for rotations
        //Gizmos.DrawIcon( _thisTransform.position + new Vector3( 0.0f, 0.3f, 0.0f ), "TickIcon.png", false );

        Gizmos.color = Color.white;
        Gizmos.DrawSphere(_thisTransform.position, 0.1f);

        if (_showDirection == true)
        {
            DrawArrow.ForGizmo(_thisTransform.position + new Vector3(0.0f, 0.05f, 0.0f), _thisTransform.forward, 0.4f);
        }
    }
Esempio n. 18
0
 public void OnDrawGizmos()
 {
     Gizmos.color = Color.green;
     Gizmos.DrawSphere(points[0].transform.position, 1.0f);
     for (int i = 1; i < points.Length; i++)
     {
         if (points[i] != null && points[i - 1] != null)
         {
             Gizmos.DrawSphere(points[i].transform.position, 1.0f);
             DrawArrow.ForGizmo(points[i - 1].transform.position, points[i].transform.position, arrowHeadLength: 2.0f);
         }
     }
 }
Esempio n. 19
0
        public void OnDrawGizmos()
        {
            switch (TriggerType)
            {
            case PassThroughTriggerType.Inner:
                break;

            default:
                Gizmos.color = Color.green;
                DrawArrow.ForGizmo(transform.position + transform.up, transform.forward, 0.25f, 20);
                break;
            }
        }
Esempio n. 20
0
    //=====================================================

    void OnDrawGizmos()
    {
        Gizmos.color = Color.magenta;
        Gizmos.DrawSphere(_thisTransform.position, 0.1f);
        DrawArrow.ForGizmo(_thisTransform.position, _thisTransform.forward, 0.4f);

        if (_isStartPoint)
        {
            Gizmos.DrawIcon(_thisTransform.position + new Vector3(0.0f, 0.3f, 0.0f), "CameraIcon.png", false);

            Gizmos.color = Color.white;
            Gizmos.DrawLine(_thisTransform.position, _lookatTarget.position);
        }
    }
Esempio n. 21
0
    public virtual void OnDrawGizmos()
    {
        Gizmos.color = color;
        Gizmos.DrawCube(transform.position, new Vector3(boxWidth, boxWidth, boxWidth));
        for (int i = 0; i < outs.Count; ++i)
        {
            Vector3 direction = outs[i].waypoint.transform.position - transform.position;
            DrawArrow.ForGizmo(transform.position + direction.normalized * arrowPositionMultiplier, direction - direction.normalized * arrowLengthMultiplier, Color.red);
        }

        if (color.Equals(Color.green) || color.Equals(Color.white))
        {
            color = mainColor();
        }
    }
Esempio n. 22
0
    //=====================================================

    void OnDrawGizmos()
    {
        Gizmos.color = GetGizmoColor();
        DrawArrow.ForGizmo(_thisTransform.position + new Vector3(0.0f, 0.05f, 0.0f), _thisTransform.forward, 0.4f);

        if (_isDoubleDoor == true)
        {
            return;
        }

        switch (_type)
        {
        case eDoorType.PUZZLE_LOCKED:
            // Draw lines between door and referenced switches
            for (var i = 0; i < _switches.Length; i++)
            {
                if (_switches[i] != null)
                {
                    Gizmos.DrawLine(_thisTransform.position, _switches[i].transform.position);
                }
            }

            // Draw hinge position - allow for rotations
            Gizmos.matrix = transform.localToWorldMatrix;
            Gizmos.DrawCube(new Vector3(0.0f, 1.0f, 0.0f), new Vector3(0.05f, 2.0f, 0.05f));
            break;

        case eDoorType.CRAWL:
        case eDoorType.OBLIVION_PORTAL:
            // Draw lines between door and referenced spawn points
            if (_spawnPoint != null)
            {
                Gizmos.DrawLine(_thisTransform.position, _spawnPoint.transform.position);
            }
            break;

        default:
            // Draw hinge position - allow for rotations
            Gizmos.matrix = transform.localToWorldMatrix;
            Gizmos.DrawCube(new Vector3(0.0f, 1.0f, 0.0f), new Vector3(0.05f, 2.0f, 0.05f));

            // Indicate door position (opposite to door rotation)
            //int direction = (_hingePosition == eHingePosition.LEFT) ? 1 : -1;
            //Gizmos.DrawCube( new Vector3( 0.5f * direction, 0.025f, 0.0f ), new Vector3( 1.0f, 0.05f, 0.05f ) );
            break;
        }
    }
        void OnDrawGizmos()
        {
            if (ShowChunksValue)
            {
                foreach (var valuableChunk in ValuableChunkPos(Range))
                {
                    DrawRectangle.ForGizmo(
                        Chunk.GetBounds(valuableChunk.Position),
                        Color.Lerp(Color.black, Color.red, valuableChunk.Value), true);
                }
            }

            if (DebugDraw)
            {
                DrawArrow.ForGizmo(transform.position, transform.forward * 10, Color.magenta, 3);
            }
        }
Esempio n. 24
0
        private void OnDrawGizmosSelected()
        {
            if (Application.isPlaying)
            {
                // velocity vector direction
                Gizmos.color = Color.magenta;
                DrawArrow.ForGizmo(transform.position, _playerRigidbody.velocity);

                // axis input plane
                Gizmos.color = Color.red;
                DebugExtension.DrawCircle(transform.position,
                                          _stickToPlanet.PlanetCurrentNormal, Color.red, 1f);
            }

            // draw current input position
            Gizmos.DrawCube(transform.position + _turnDirection,
                            Vector3.one * 0.15f);
        }
Esempio n. 25
0
 void showVisitedList(float radius, Color color)
 {
     if (Visited.dictionary.Count == 0)
     {
         Debug.LogWarning("Visited List is Empty");
     }
     else
     {
         foreach (ARAstarNode node in Visited.dictionary.Values)
         {
             Vector3 nodePosition = node.action.state.statePosition();
             Vector3 direction    = node.action.state.statePosition() - node.previousState.statePosition();
             Gizmos.color = color;
             Gizmos.DrawSphere(node.action.state.statePosition(), radius);
             DrawArrow.ForGizmo(node.previousState.statePosition(), direction, Color.black);
         }
     }
 }
Esempio n. 26
0
 void showInconsList(float radius, Color color)
 {
     if (Incons.Elements().Count == 0)
     {
         Debug.LogWarning("Inconsistent List is Empty");
     }
     else
     {
         foreach (ARAstarNode node in Incons.Elements().Values)
         {
             Vector3 nodePosition = node.action.state.statePosition();
             Vector3 direction    = node.action.state.statePosition() - node.previousState.statePosition();
             Gizmos.color = color;
             Gizmos.DrawSphere(node.action.state.statePosition(), radius);
             DrawArrow.ForGizmo(node.previousState.statePosition(), direction, Color.black);
         }
     }
 }
Esempio n. 27
0
        private void OnDrawGizmosSelected()
        {
            Gizmos.DrawWireCube(transform.position, new Vector3(fieldSize.x, 1, fieldSize.y));

            if (!Application.isPlaying || !drawArrows)
            {
                return;
            }
            for (int x = 0; x < _gridSize.x; x++)
            {
                for (int y = 0; y < _gridSize.x; y++)
                {
                    Flow flow = field[x, y];
                    DrawArrow.ForGizmo(flow.position, flow.direction, Color.green, 0.2f);
                    //Gizmos.DrawLine(flow.position, flow.direction);
                }
            }
        }
Esempio n. 28
0
    private void OnDrawGizmos()
    {
        if (doorSize.x < 1)
        {
            doorSize.x = 1;
        }
        if (doorSize.y < 1)
        {
            doorSize.y = 1;
        }
        Vector3 center = transform.position + new Vector3(0.5f + (doorSize.x - 1) / 2, -0.5f - (doorSize.y - 1) / 2);

        Gizmos.color = new Color(1, 0, 1, 0.8f);
        Gizmos.DrawCube(center, doorSize);
        DrawArrow.ForGizmo(center, MoveScripts.GetVector2FromDirection(exitDirection), new Color(1, 1, 1, 1f), 0.5f, 20f);
        GetComponent <BoxCollider2D>().offset = center - transform.position;
        GetComponent <BoxCollider2D>().size   = doorSize;
    }
Esempio n. 29
0
 void showOpenList(float radius, Color color)
 {
     if (openSet.Count == 0)
     {
         Debug.LogWarning("Open List is Empty");
     }
     else
     {
         foreach (BestFirstSearchNode node in openSet)
         {
             Vector3 nodePosition = node.action.state.statePosition();
             Vector3 direction    = node.action.state.statePosition() - node.previousState.statePosition();
             Gizmos.color = color;
             Gizmos.DrawSphere(node.action.state.statePosition(), radius);
             DrawArrow.ForGizmo(node.previousState.statePosition(), direction, Color.black);
         }
     }
 }
            public void DrawGizmosSelected()
            {
                Gizmos.color = Color.yellow;

                if (_branches != null)
                {
                    for (int i = 0, n = _branches.Length; i < n; i++)
                    {
                        _branches[i].DrawGizmosSelected();
                    }
                }

                for (int i = 0, n = _segments.Length; i < n; i++)
                {
                    Segment segment   = _segments[i];
                    Vector3 direction = segment.rotation * Vector3.up;
                    DrawArrow.ForGizmo(segment.position, direction.normalized);
                }
            }