回答編集履歴

2

修正

2018/03/25 03:16

投稿

退会済みユーザー
test CHANGED
@@ -26,6 +26,24 @@
26
26
 
27
27
 
28
28
 
29
+ void Start() {
30
+
31
+ rotationX = transform.localEulerAngles.y;
32
+
33
+ if (rotationX > 180f)
34
+
35
+ rotationX -= 360f;
36
+
37
+ rotationY = transform.localEulerAngles.x;
38
+
39
+ if (rotationY > 180f)
40
+
41
+ rotationY -= 360f;
42
+
43
+ }
44
+
45
+
46
+
29
47
  void Update() {
30
48
 
31
49
  rotationX += Input.GetAxis ("Mouse X") * speedX;
@@ -40,6 +58,4 @@
40
58
 
41
59
  }
42
60
 
43
-
44
-
45
61
  ```

1

修正

2018/03/25 03:16

投稿

退会済みユーザー
test CHANGED
@@ -26,25 +26,15 @@
26
26
 
27
27
 
28
28
 
29
- void Start() {
30
-
31
- rotationX = transform.localEulerAngles.y;
32
-
33
- rotationY = -transform.localEulerAngles.x;
34
-
35
- }
36
-
37
-
38
-
39
29
  void Update() {
40
30
 
41
31
  rotationX += Input.GetAxis ("Mouse X") * speedX;
42
32
 
43
- rotationY += Input.GetAxis ("Mouse Y") * speedY;
33
+ rotationY -= Input.GetAxis ("Mouse Y") * speedY;
44
34
 
45
35
  rotationY = Mathf.Clamp (rotationY, minY, maxY);
46
36
 
47
- transform.localEulerAngles = new Vector3 (-rotationY, rotationX, 0f);
37
+ transform.localEulerAngles = new Vector3 (rotationY, rotationX, 0f);
48
38
 
49
39
  }
50
40