官方的坦克大战教程,然后我在tank对象下写了一个脚本,fixupdate调用,用canvas text写出速度,但是一直很诡异,用世界坐标就是0,0,0,用模就是一会大一会小。只有顶仓库的时候速度才有数据



m_rigidbody = GetComponent<Rigidbody>();
if (GetComponentInChildren<Text>())
{
m_text = GetComponentInChildren<Text>();
m_text.text = transform.InverseTransformDirection(m_rigidbody.velocity).ToString();
}



m_rigidbody = GetComponent<Rigidbody>();
if (GetComponentInChildren<Text>())
{
m_text = GetComponentInChildren<Text>();
m_text.text = transform.InverseTransformDirection(m_rigidbody.velocity).ToString();
}
