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个回答
ZESTRON
2024-09-04 广告
2024-09-04 广告
在Dr. O.K. Wack Chemie GmbH,我们高度重视ZESTRON的表界面分析技术。该技术通过深入研究材料表面与界面的性质,为提升产品质量与可靠性提供了有力支持。ZESTRON的表界面分析不仅涵盖了相变化、化学反应、吸附与解吸...
点击进入详情页
本回答由ZESTRON提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询