unity 帮助文档怎么还运行出问题呢cannot convert 'unityEngine.GameObject'to 'unityEngine.Rigidbody'function Update () {// Ctrl was pressed,launch a projectileif (Input.GetButtonDown("Fire1")) {// Instantiate the projectile at the position
来源:学生作业帮助网 编辑:作业帮 时间:2024/07/12 11:44:45
![unity 帮助文档怎么还运行出问题呢cannot convert 'unityEngine.GameObject'to 'unityEngine.Rigidbody'function Update () {// Ctrl was pressed,launch a projectileif (Input.GetButtonDown(](/uploads/image/z/15012457-25-7.jpg?t=unity+%E5%B8%AE%E5%8A%A9%E6%96%87%E6%A1%A3%E6%80%8E%E4%B9%88%E8%BF%98%E8%BF%90%E8%A1%8C%E5%87%BA%E9%97%AE%E9%A2%98%E5%91%A2cannot+convert+%27unityEngine.GameObject%27to+%27unityEngine.Rigidbody%27function+Update+%28%29+%7B%2F%2F+Ctrl+was+pressed%2Claunch+a+projectileif+%28Input.GetButtonDown%28%22Fire1%22%29%29+%7B%2F%2F+Instantiate+the+projectile+at+the+position)
unity 帮助文档怎么还运行出问题呢cannot convert 'unityEngine.GameObject'to 'unityEngine.Rigidbody'function Update () {// Ctrl was pressed,launch a projectileif (Input.GetButtonDown("Fire1")) {// Instantiate the projectile at the position
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 'unityEngine.Rigidbody'function Update () {// Ctrl was pressed,launch a projectileif (Input.GetButtonDown("Fire1")) {// Instantiate the projectile at the position
你确定你的projectile是一个Rigidbody?