UnityEditor.SceneView.LookAtDirect C# (CSharp) Method

LookAtDirect() public method

public LookAtDirect ( Vector3 pos, Quaternion rot ) : void
pos Vector3
rot UnityEngine.Quaternion
return void
        public void LookAtDirect(Vector3 pos, Quaternion rot)
        {
            this.FixNegativeSize();
            this.m_Position.value = pos;
            this.m_Rotation.value = rot;
            this.svRot.UpdateGizmoLabel(this, (Vector3) (rot * Vector3.forward), this.m_Ortho.target);
        }

Same methods

SceneView::LookAtDirect ( Vector3 pos, Quaternion rot, float newSize ) : void

Usage Example

示例#1
1
    public void OnSceneGUI(SceneView scene)
    {
        if(setPerspective){
            /* Selection.transforms	*/
            setPerspective = false;
            float angle = 30;
            Texture baseTile = IsoSettingsManager.getInstance().getIsoSettings().defautTextureScale;
            if(baseTile != null){
                float angulo = Mathf.Rad2Deg * Mathf.Acos(baseTile.height / (baseTile.width*1f));
                angle = 90f - angulo;
            }
            scene.LookAtDirect(scene.pivot,Quaternion.Euler(angle, 45, 0));
            scene.orthographic = true;

            if(fixView)
                fixedRotation = Quaternion.Euler(angle, 45, 0);

            scene.Repaint();
        }

        if(fixView)
            scene.LookAtDirect(scene.pivot,fixedRotation);

        HandleUtility.AddDefaultControl(GUIUtility.GetControlID(FocusType.Passive));
        if(Event.current.isMouse){
            if(Event.current.button == 0){
                if(Event.current.type == EventType.MouseDown)		startCreatingCells();
                else if(Event.current.type == EventType.MouseUp)	endCreatingCells();
                else												createCell();
            }
            else if(Event.current.button == 1){
                if(Event.current.type == EventType.MouseDown)		startMovingGrid();
                else if(Event.current.type == EventType.MouseUp)	endMovingGrid();
                else												moveGrid();
            }
            scene.Repaint();
        }

        Vector3 centerGridPoint = map.getMousePositionOverMap(HandleUtility.GUIPointToWorldRay(Event.current.mousePosition), Mathf.RoundToInt(gridHeight*2f)/2f);

        map.ghostCell(centerGridPoint, 0.5f);

        Vector3[] puntos = new Vector3[4];
        puntos[0] = new Vector3(centerGridPoint.x - cellSize/2.0f,centerGridPoint.y,centerGridPoint.z - cellSize/2.0f);
        puntos[1] = new Vector3(centerGridPoint.x - cellSize/2.0f,centerGridPoint.y,centerGridPoint.z + cellSize/2.0f);
        puntos[2] = new Vector3(centerGridPoint.x + cellSize/2.0f,centerGridPoint.y,centerGridPoint.z + cellSize/2.0f);
        puntos[3] = new Vector3(centerGridPoint.x + cellSize/2.0f,centerGridPoint.y,centerGridPoint.z - cellSize/2.0f);
        Handles.DrawSolidRectangleWithOutline(puntos, Color.yellow, Color.white);
    }
All Usage Examples Of UnityEditor.SceneView::LookAtDirect