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/11/24 21:25:38
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?