summaryrefslogtreecommitdiff
path: root/ActiveRagdoll/Assets/TABG/Scripts/Debug/DebugSceneCamera.cs
blob: 992c1c750fd8379cc21b98425e8b951453dfc10e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;

public class DebugSceneCamera : MonoBehaviour
{
    public Transform target;

    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        //var camera = SceneView.lastActiveSceneView.camera;
        //if(camera != null)
        //{
        //    Debug.Log("asdasd");

        //    Vector3 pos = target.position;

        //    camera.transform.position = pos + target.right * -10;
        //    camera.transform.forward = target.right;

        //}

        //Camera cameraMain = Camera.main;
        //var sceneView = SceneView.lastActiveSceneView;
        //if (sceneView != null)
        //{
        //    sceneView.cameraSettings.nearClip = cameraMain.nearClipPlane;
        //    sceneView.cameraSettings.fieldOfView = cameraMain.fieldOfView;
        //    sceneView.pivot = cameraMain.transform.position +
        //        cameraMain.transform.forward * sceneView.cameraDistance;
        //    sceneView.rotation = cameraMain.transform.rotation;
        //}

        var sceneView = SceneView.lastActiveSceneView;
        if (sceneView != null)
        {
            sceneView.pivot = target.position;
            Quaternion rot = Quaternion.LookRotation(target.right);
            sceneView.LookAtDirect(target.position, rot);
        }

    }
}