- 最后登录
- 2013-9-29
- 注册时间
- 2012-8-20
- 阅读权限
- 90
- 积分
- 6371
- 纳金币
- 6372
- 精华
- 0
|
function OnMouseDown () {
var screenSpace = Camera.main.WorldToScreenPoint(transform.position);
var offset = transform.position - Camera.main.ScreenToWorldPoint(Vector3(Input.mousePosition.x, Input.mousePosition.y, screenSpace.z));
while (Input.GetMouseButton(0))
{
var curScreenSpace = Vector3(Input.mousePosition.x, Input.mousePosition.y, screenSpace.z);
var curPosition = Camera.main.ScreenToWorldPoint(curScreenSpace) + offset;
transform.position = curPosition;
yield;
}
}
|
|