回答編集履歴
2
修正
test
CHANGED
@@ -16,7 +16,7 @@
|
|
16
16
|
|
17
17
|
public Vector3 end;
|
18
18
|
|
19
|
-
public float deltaX;
|
19
|
+
public float deltaX = 0f;
|
20
20
|
|
21
21
|
public Camera mainCamera;
|
22
22
|
|
1
アニメーションするように変更
test
CHANGED
@@ -16,15 +16,13 @@
|
|
16
16
|
|
17
17
|
public Vector3 end;
|
18
18
|
|
19
|
-
|
19
|
+
public float deltaX;
|
20
20
|
|
21
21
|
public Camera mainCamera;
|
22
22
|
|
23
23
|
|
24
24
|
|
25
25
|
void Update () {
|
26
|
-
|
27
|
-
|
28
26
|
|
29
27
|
if (Input.GetMouseButtonDown (0)) {
|
30
28
|
|
@@ -36,9 +34,13 @@
|
|
36
34
|
|
37
35
|
end = Input.mousePosition;
|
38
36
|
|
39
|
-
|
37
|
+
deltaX = (start - end).x;
|
40
38
|
|
41
39
|
}
|
40
|
+
|
41
|
+
mainCamera.transform.Translate (deltaX * Time.deltaTime, 0f, 0f);
|
42
|
+
|
43
|
+
deltaX *= 0.9f;
|
42
44
|
|
43
45
|
}
|
44
46
|
|