【发布时间】:2015-12-29 18:09:49
【问题描述】:
我有一个 2D 手机游戏,我需要触摸和拖动对象。这是一个脚本(对象不会随着这个脚本顺利移动)。我想在当时手指的位置移动物体。
public float speed;
void Update ()
{
if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Moved)
{
Vector2 touchDeltaPosition = Input.GetTouch(0).deltaPosition;
transform.Translate(touchDeltaPosition.x * speed, 0, 0);
}
怎么办?
谢谢 亲切的问候
【问题讨论】: