LookAtを使いゲームオブジェクトの位置まで移動させる事は出来たのですが、
ターゲットの方向に向かずにプレイヤー依存で無回転で移動させたいです。
どなたかお詳しい方がいらっしゃいましたら、教えていただけたら幸いですm(_ _)m
C#
1using System.Collections; 2using System.Collections.Generic; 3using UnityEngine; 4 5public class MoveTarget: MonoBehaviour 6{ 7 8 public GameObject Target; 9 public float speed = 5.0f; 10 11 // Use this for initialization 12 void Start() 13 { 14 15 } 16 17 // Update is called once per frame 18 void Update() 19 { 20 transform.LookAt(Target.transform); 21 transform.position += transform.forward.normalized * speed * Time.deltaTime; 22 } 23}
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2020/01/12 02:39