请问unity3D的3.5版本中这段代码错在哪里?
voidFixedUpdate(){if(Input.GetMouseButton(0)){Rayray=Camera.main.ScreenPointToRay(Inp...
void FixedUpdate()
{
if(Input.GetMouseButton(0))
{
Ray ray = Camera.main.ScreenPointToRay(Input.mouseposition);
RaycastHit hit;
if(Physics.Raycast(ray, out hit))
{
if(hit.collider.name == "Cube")
{ Vector3 direction = hit.transform.position - obj.transform.position;
obj.rigidbody.AddForceAtPosition(direction,hit.transform.position,ForceMode.Impulse);
}
}
}
} 展开
{
if(Input.GetMouseButton(0))
{
Ray ray = Camera.main.ScreenPointToRay(Input.mouseposition);
RaycastHit hit;
if(Physics.Raycast(ray, out hit))
{
if(hit.collider.name == "Cube")
{ Vector3 direction = hit.transform.position - obj.transform.position;
obj.rigidbody.AddForceAtPosition(direction,hit.transform.position,ForceMode.Impulse);
}
}
}
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询