Einheit OnMouseDrag() Drag-and-Drop

Versucht zu ziehen und ein Spiel-Objekt auf der x-und y-Achse. Aus irgendeinem Grund werden die Werte der x -, y-und z kleiner als die Zeit weitergeht, auch wenn die Maus nicht bewegt. Kann mir jemand erklären, warum dies passiert ist?

using UnityEngine;
using System.Collections;

public class Drag : MonoBehaviour {

    Vector3 point;
    float x;
    float y;
    float z;

    void Update () {

    }

    void OnMouseDrag()
    {
        x = Input.mousePosition.x;
        y = Input.mousePosition.y;
        z = gameObject.transform.position.z;

        point = Camera.main.ScreenToWorldPoint (new Vector3 (x, y, z));
        gameObject.transform.position = point;

        Debug.Log ("x: " + point.x + "   y: " + point.y + "   z: " + point.z);
    }
}
InformationsquelleAutor Tommy J | 2014-07-10
Schreibe einen Kommentar