前提・実現したいこと
unityでレースゲームを制作しています。
車の速度を取得したく、スクリプトを考えていました。
前回の質問で教えていただいたスクリプトを使用してみましたがエラーでした。
エラーメッセージ
該当のソースコード
`using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Speed : MonoBehaviour {
private Vector3 latestPos; Vector3 speed; GameObject player; void Start(){ player = GameObject.Find("Car"); } void Update () { speed = (player.transform.position - latestPos) / Time.deltaTime.magnitude; latestPos = player.transform.position; }
}
補足情報(FW/ツールのバージョンなど)
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/07/20 22:40
2018/07/21 05:56 編集
2018/07/22 03:55
2018/07/22 06:19
2018/07/22 07:51
2018/07/22 10:45