質問編集履歴
2
コードの変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -30,13 +30,15 @@
|
|
30
30
|
|
31
31
|
{
|
32
32
|
|
33
|
-
|
33
|
+
Vector3 screenPoint = Camera.main.WorldToScreenPoint (transform.position);
|
34
34
|
|
35
|
-
Vector3 offset = transform.position - Camera.main.ScreenToWorldPoint
|
36
35
|
|
37
|
-
(new Vector3 (Input.mousePosition.x, Input.mousePosition.y, screenPoint.z));
|
38
36
|
|
37
|
+
Vector3 offset = Camera.main.ScreenToWorldPoint
|
38
|
+
|
39
|
+
(new Vector3 (Input.mousePosition.x,Input.mousePosition.y, screenPoint.z)) - transform.position;
|
40
|
+
|
39
|
-
gameObject.GetComponent<Rigidbody>().AddForce(offset);
|
41
|
+
gameObject.GetComponent<Rigidbody>().AddForce(offset * 10f);
|
40
42
|
|
41
43
|
}
|
42
44
|
|
1
コードの変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -30,13 +30,13 @@
|
|
30
30
|
|
31
31
|
{
|
32
32
|
|
33
|
-
|
33
|
+
Vector3 screenPoint = Camera.main.WorldToScreenPoint (transform.position);
|
34
34
|
|
35
|
-
|
35
|
+
Vector3 offset = transform.position - Camera.main.ScreenToWorldPoint
|
36
36
|
|
37
|
-
|
37
|
+
(new Vector3 (Input.mousePosition.x, Input.mousePosition.y, screenPoint.z));
|
38
38
|
|
39
|
-
|
39
|
+
gameObject.GetComponent<Rigidbody>().AddForce(offset);
|
40
40
|
|
41
41
|
}
|
42
42
|
|