質問編集履歴
2
書式の改善
title
CHANGED
File without changes
|
body
CHANGED
@@ -24,4 +24,23 @@
|
|
24
24
|
}
|
25
25
|
}
|
26
26
|
|
27
|
+
```
|
28
|
+
### 追記2
|
29
|
+
↓現在のスクリプト
|
30
|
+
```c#
|
31
|
+
using System.Collections;
|
32
|
+
using System.Collections.Generic;
|
33
|
+
using UnityEngine;
|
34
|
+
|
35
|
+
public class PlayerController : MonoBehaviour {
|
36
|
+
Rigidbody2D rb;
|
37
|
+
|
38
|
+
void Start () {
|
39
|
+
rb = GetComponent<Rigidbody2D>().velocity;
|
40
|
+
}
|
41
|
+
|
42
|
+
public void OnDrag() {
|
43
|
+
rigidbody.velocity = Camera.main.ScreenToWorldPoint(Vector3.forward * 0.1f);
|
44
|
+
}
|
45
|
+
}
|
27
46
|
```
|
1
書式の改善
title
CHANGED
File without changes
|
body
CHANGED
@@ -6,4 +6,22 @@
|
|
6
6
|
・RightBody2DのCollision Detectionを**Continuos**に変更
|
7
7
|

|
8
8
|
・Time Managerの**Fixed Timestep**の値を細かくする
|
9
|
-

|
9
|
+

|
10
|
+
|
11
|
+
### 追記
|
12
|
+
↓オブジェクトをドラッグで動かすスクリプト
|
13
|
+
```c#
|
14
|
+
using System.Collections;
|
15
|
+
using System.Collections.Generic;
|
16
|
+
using UnityEngine;
|
17
|
+
|
18
|
+
public class PlayerController : MonoBehaviour {
|
19
|
+
|
20
|
+
public void OnDrag() {
|
21
|
+
Vector3 TapPos = Input.mousePosition;
|
22
|
+
TapPos.z = 10f;
|
23
|
+
transform.position = Camera.main.ScreenToWorldPoint(TapPos);
|
24
|
+
}
|
25
|
+
}
|
26
|
+
|
27
|
+
```
|