質問編集履歴

5

コードの追加

2018/12/02 12:58

投稿

dragontown
dragontown

スコア16

test CHANGED
File without changes
test CHANGED
@@ -80,4 +80,76 @@
80
80
 
81
81
  }
82
82
 
83
+
84
+
85
+
86
+
87
+ 他に該当箇所かも知れない部分です。
88
+
89
+
90
+
91
+ if (Mathf.Approximately(mouseScrollDelta, 0) == false) {
92
+
93
+ if(isEditorInputRotate == true) {
94
+
95
+ if(EnableRotation == true) {
96
+
97
+ Vector3 rotationAxis = GetRotationAxis();
98
+
99
+ Vector3 intersectionScreenCenter = GetIntersectionPoint(Cam.ScreenPointToRay(Input.mousePosition));
100
+
101
+ Transform.RotateAround(intersectionScreenCenter, rotationAxis, mouseScrollDelta * 100);
102
+
103
+ ComputeCamBoundaries();
104
+
105
+ }
106
+
107
+ } else if(isEditorInputTilt == true) {
108
+
109
+ if(EnableTilt == true) {
110
+
111
+ UpdateCameraTilt(mouseScrollDelta * 100);
112
+
113
+ }
114
+
115
+ } else {
116
+
117
+ float editorZoomFactor = 15;
118
+
119
+ if (Cam.orthographic) {
120
+
121
+ editorZoomFactor = 15;
122
+
123
+ } else {
124
+
125
+ if (IsTranslationZoom) {
126
+
127
+ editorZoomFactor = 30;
128
+
129
+ } else {
130
+
131
+ editorZoomFactor = 100;
132
+
133
+ }
134
+
135
+ }
136
+
137
+ float zoomAmount = mouseScrollDelta * editorZoomFactor;
138
+
139
+ float camSizeDiff = DoEditorCameraZoom(zoomAmount);
140
+
141
+ Vector3 intersectionScreenCenter = GetIntersectionPoint(Cam.ScreenPointToRay(new Vector3(Screen.width * 0.5f, Screen.height * 0.5f, 0)));
142
+
143
+ Vector3 pinchFocusVector = GetIntersectionPoint(Cam.ScreenPointToRay(Input.mousePosition)) - intersectionScreenCenter;
144
+
145
+ float multiplier = (1.0f / CamZoom * camSizeDiff);
146
+
147
+ Transform.position += pinchFocusVector * multiplier;
148
+
149
+ }
150
+
151
+ }
152
+
153
+
154
+
83
155
  ```

4

タイトルなど変更

2018/12/02 12:58

投稿

dragontown
dragontown

スコア16

test CHANGED
@@ -1 +1 @@
1
- 【Unity】画面の回転90°毎にぴったり止まるように制限をつけたい
1
+ 【Unity】画面の回転90°毎にぴったり止まるように制限をつけたい
test CHANGED
File without changes

3

説明の修正

2018/12/02 04:21

投稿

dragontown
dragontown

スコア16

test CHANGED
@@ -1 +1 @@
1
- 【Unity】画面の回転を90°毎にぴったり止まるようにたい
1
+ 【Unity】画面の回転を90°毎にぴったり止まるように制限をつけたい
test CHANGED
@@ -8,9 +8,9 @@
8
8
 
9
9
  その中の機能に「Enable Rotation」という項目があって、
10
10
 
11
- これをオンにして作ると、スマホの画面を回転させることができるのですが、
11
+ これをオンにして作ると、指でスマホの画面を回転させることができるのですが、
12
12
 
13
- 細かな角度まで調節できてしまい、真横、真っすぐに合わせるのが難しいので、
13
+ 任意の細かな角度まで調節できてしまい、真横、真っすぐに合わせるのが難しいので、
14
14
 
15
15
  90°毎にピタリと合うように
16
16
 

2

コードの訂正

2018/12/01 20:18

投稿

dragontown
dragontown

スコア16

test CHANGED
File without changes
test CHANGED
@@ -76,6 +76,8 @@
76
76
 
77
77
  resultMin = new Vector2(Mathf.Min(v0Rot.x, v1Rot.x, v2Rot.x, v3Rot.x), Mathf.Min(v0Rot.y, v1Rot.y, v2Rot.y, v3Rot.y));
78
78
 
79
- resultMax = new Vector2(Mathf.Max(v0Rot.x, v1Rot.x, v2Rot.x, v3Rot.x), Mathf.Max(v0Rot.y, v1Rot.y, v2Rot.y, v3Rot.y)); ```
79
+ resultMax = new Vector2(Mathf.Max(v0Rot.x, v1Rot.x, v2Rot.x, v3Rot.x), Mathf.Max(v0Rot.y, v1Rot.y, v2Rot.y, v3Rot.y));
80
+
81
+ }
80
82
 
81
83
  ```

1

説明の修正

2018/12/01 20:02

投稿

dragontown
dragontown

スコア16

test CHANGED
@@ -1 +1 @@
1
- 【Unity】画面の回転を45°毎にぴったり止まるようにしたい
1
+ 【Unity】画面の回転を90°毎にぴったり止まるようにしたい
test CHANGED
@@ -2,15 +2,31 @@
2
2
 
3
3
  ```
4
4
 
5
- Unityで、ピンチズームやスクロール機能をつけることができるAssetを購入し
5
+ Unityで、ピンチズームやスクロール機能をつけることができるAssetを購入し
6
6
 
7
- Main Cameraに貼って「Enable Rotation」という項目をオンにると
7
+ Main Cameraに貼ってありま
8
8
 
9
+ その中の機能に「Enable Rotation」という項目があって、
10
+
9
- 二本指で画面を回転させることができるのですが、
11
+ これをオンにして作ると、スマホの画面を回転させることができるのですが、
10
12
 
11
13
  細かな角度まで調節できてしまい、真横、真っすぐに合わせるのが難しいので、
12
14
 
13
- 45°毎にピタリと合うように変更したいと思っています。
15
+ 90°毎にピタリと合うように
16
+
17
+
18
+
19
+ ̠315°~45°:0°
20
+
21
+ 45°~135°:90°
22
+
23
+ 135°~225°:180°
24
+
25
+ 225°~315°:270°
26
+
27
+
28
+
29
+ というような感じにしたいです。
14
30
 
15
31
 
16
32