作业帮 > 英语 > 作业

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

来源:学生作业帮 编辑:搜搜做题作业网作业帮 分类:英语作业 时间:2024/06/12 19:42:26
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);
}
}
unity 帮助文档怎么还运行出问题呢cannot convert 'unityEngine.GameObject'to
你确定你的projectile是一个Rigidbody?