質問編集履歴

2

書式の改善

2018/08/07 14:15

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -51,3 +51,41 @@
51
51
 
52
52
 
53
53
  ```
54
+
55
+ ### 追記2
56
+
57
+ ↓現在のスクリプト
58
+
59
+ ```c#
60
+
61
+ using System.Collections;
62
+
63
+ using System.Collections.Generic;
64
+
65
+ using UnityEngine;
66
+
67
+
68
+
69
+ public class PlayerController : MonoBehaviour {
70
+
71
+ Rigidbody2D rb;
72
+
73
+
74
+
75
+ void Start () {
76
+
77
+ rb = GetComponent<Rigidbody2D>().velocity;
78
+
79
+ }
80
+
81
+
82
+
83
+ public void OnDrag() {
84
+
85
+ rigidbody.velocity = Camera.main.ScreenToWorldPoint(Vector3.forward * 0.1f);
86
+
87
+ }
88
+
89
+ }
90
+
91
+ ```

1

書式の改善

2018/08/07 14:14

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -15,3 +15,39 @@
15
15
  ・Time Managerの**Fixed Timestep**の値を細かくする
16
16
 
17
17
  ![イメージ説明](2e2ed7c56f2fe91246dfad24cbb30a6e.png)
18
+
19
+
20
+
21
+ ### 追記
22
+
23
+ ↓オブジェクトをドラッグで動かすスクリプト
24
+
25
+ ```c#
26
+
27
+ using System.Collections;
28
+
29
+ using System.Collections.Generic;
30
+
31
+ using UnityEngine;
32
+
33
+
34
+
35
+ public class PlayerController : MonoBehaviour {
36
+
37
+
38
+
39
+ public void OnDrag() {
40
+
41
+ Vector3 TapPos = Input.mousePosition;
42
+
43
+ TapPos.z = 10f;
44
+
45
+ transform.position = Camera.main.ScreenToWorldPoint(TapPos);
46
+
47
+ }
48
+
49
+ }
50
+
51
+
52
+
53
+ ```