unity5为什么用不了Addforce
if(Input.GetButtonDown("Fire1")){varn:Transform=Instantiate(newobject,transform.posit...
if(Input.GetButtonDown("Fire1")){
var n:Transform =Instantiate(newobject,transform.position,transform.rotation);
var fwd:Vector3=transform.TransformDirection(Vector3.forward);
n.rigidbody.AddForce (Vector3.forward);
//var clone:Rigidbody;
//clone=Instantiate(newobject,transform.position,transform.rotation);
//clone.velocity=transform.TransformDirection(Vector3.forward*28000);
}
D:\VR Project\MyVR\Assets\scripts\MainCamara.js(19,19): Error BCE0144: 'UnityEngine.Component.rigidbody' is obsolete. Property rigidbody has been deprecated. Use GetComponent<Rigidbody>() instead. (UnityUpgradable) (BCE0144) (Assembly-UnityScript)
D:\VR Project\MyVR\Assets\scripts\MainCamara.js(29,29): Error BCE0019: 'AddForce' is not a member of 'UnityEngine.Component'. (BCE0019) (Assembly-UnityScript)
完全和教程一样,为什么会错呢 展开
var n:Transform =Instantiate(newobject,transform.position,transform.rotation);
var fwd:Vector3=transform.TransformDirection(Vector3.forward);
n.rigidbody.AddForce (Vector3.forward);
//var clone:Rigidbody;
//clone=Instantiate(newobject,transform.position,transform.rotation);
//clone.velocity=transform.TransformDirection(Vector3.forward*28000);
}
D:\VR Project\MyVR\Assets\scripts\MainCamara.js(19,19): Error BCE0144: 'UnityEngine.Component.rigidbody' is obsolete. Property rigidbody has been deprecated. Use GetComponent<Rigidbody>() instead. (UnityUpgradable) (BCE0144) (Assembly-UnityScript)
D:\VR Project\MyVR\Assets\scripts\MainCamara.js(29,29): Error BCE0019: 'AddForce' is not a member of 'UnityEngine.Component'. (BCE0019) (Assembly-UnityScript)
完全和教程一样,为什么会错呢 展开
2个回答
微测检测5.10
2023-05-10 广告
2023-05-10 广告
您好!建议咨 深圳市微测检测有限公司,已建立起十余个专业实验室,企业通过微测检测就可以获得一站式的测试与认 证解决方案;(EMC、RF、MFi、BQB、QI、USB、安全、锂电池、快充、汽车电子EMC、汽车手机互 联、语音通话质量),认证遇...
点击进入详情页
本回答由微测检测5.10提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询