teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

書式の改善

2018/08/07 14:15

投稿

退会済みユーザー
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

書式の改善

2018/08/07 14:14

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -6,4 +6,22 @@
6
6
  ・RightBody2DのCollision Detectionを**Continuos**に変更
7
7
  ![イメージ説明](30b6c7bb475240166d81f5578bcc3355.png)
8
8
  ・Time Managerの**Fixed Timestep**の値を細かくする
9
- ![イメージ説明](2e2ed7c56f2fe91246dfad24cbb30a6e.png)
9
+ ![イメージ説明](2e2ed7c56f2fe91246dfad24cbb30a6e.png)
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
+ ```