- 最后登录
- 2017-6-30
- 注册时间
- 2012-12-27
- 阅读权限
- 90
- 积分
- 10267
  
- 纳金币
- 6520
- 精华
- 14
|
在脚本中能使用可以用Vector3.up等,但不能用Vector3(0,1,0)等,提示错误为:
error CS0119: Expression denotes a `type', where a `variable', `value' or `method group' was expected
代码如下,最后一行出错
if(Input.GetMouseButtonDown(0)) {
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hitInfo;
if (Physics.Raycast(ray.origin, ray.direction,out hitInfo)) {
Vector3 targetPosition = hitInfo.point;
transform.position = targetPosition + Vector3(0,1.0f,0);//这里如果用Vector3.up就不会出错
}
}
是什么原因呢?不都是Vector3类型么
|
|