2020년 1월 7일 화요일

쳐다보는 화살표 UI (UI Arrow Lookat)

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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
 if (currentOnOffState && m_Lenders.Count == 2//생기기전에 회전해버리면 위치가 안맞는 일이 생김
        {
            if (m_text_currentHeight == null && m_text_DBHeight == null)
            {
                return;
            }
            if (prev_Cam_Rot != Camera.main.transform.rotation || prev_Cam_Pos != Camera.main.transform.position)
            {
                prev_Cam_Rot = Camera.main.transform.rotation;
                prev_Cam_Pos = Camera.main.transform.position;
                m_text_currentHeight.text = currentHeight.ToString()+"\n"+" ("+ (currentHeight - DBHeight).ToString() +")";
                m_text_DBHeight.text = DBHeight.ToString();
                OnlyZLookAt(temp_All_Parent.transform);
                m_text_currentHeight.transform.LookAt(m_text_currentHeight.transform.position + Camera.main.transform.rotation * Vector3.forward, Camera.main.transform.rotation * Vector3.up);
                m_text_DBHeight.transform.LookAt(m_text_DBHeight.transform.position + Camera.main.transform.rotation * Vector3.forward, Camera.main.transform.rotation * Vector3.up);
            }
        }
 void OnlyZLookAt(Transform Target)
    {
       
        Vector3 intoPlane = -Vector3.up;
        // Calculate a vector pointing to the target.
        Vector3 toTarget = Camera.main.transform.position - Target.position;
        // Point our Z+ into the gameplay plane,
        // and our Y+ away from the target.
        // (Since our "front" is at the bottom/Y- extreme)
        Target.rotation = Quaternion.LookRotation(intoPlane, -toTarget);
        //Target.LookAt(Target.transform.position + Camera.main.transform.up);
    }
cs

댓글 없음:

댓글 쓰기

git rejected error(feat. cherry-pick)

 문제 아무 생각 없이 pull을 받지않고 로컬에서 작업! 커밋, 푸시 진행을 해버렷다. push에선 remote와 다르니 당연히 pull을 진행해라고 하지만 로컬에서 작업한 내용을 백업하지 않고 진행하기에는 부담스럽다(로컬작업 유실 가능성) 해결하려...