作业帮 > 英语 > 作业

unity 帮助文档怎么还运行出问题呢cannot convert 'unityEngine.GameObject'to

来源:学生作业帮 编辑:夺魁考试网作业帮 分类:英语作业 时间:2021/08/01 21:31:12
unity 帮助文档怎么还运行出问题呢cannot convert 'unityEngine.GameObject'to 'unityEngine.Rigidbody'
function Update () {
// Ctrl was pressed,launch a projectile
if (Input.GetButtonDown("Fire1")) {
// Instantiate the projectile at the position and rotation of this transform
var clone :Rigidbody;
clone = Instantiate(projectile,transform.position,transform.rotation);
// Give the cloned object an initial velocity along the current
// object's Z axis
clone.velocity = transform.TransformDirection (Vector3.forward * 10);
}
}
你确定你的projectile是一个Rigidbody?