回答編集履歴
1
ProjectionがPerspectiveのカメラにも対応するようにコードを修正
answer
CHANGED
@@ -17,7 +17,7 @@
|
|
17
17
|
if (Input.GetMouseButtonDown(0))
|
18
18
|
{
|
19
19
|
// タッチした座標を取得
|
20
|
-
Vector3 touchPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
|
20
|
+
Vector3 touchPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition + new Vector3(0.0f, 0.0f, 10.0f));
|
21
21
|
|
22
22
|
// ターゲットからタッチした座標への正規化ベクトルを取得
|
23
23
|
Vector3 toTouchPosition = Vector3.Scale(touchPosition - target.position, new Vector3(1.0f, 1.0f, 0.0f)).normalized;
|