Esempio n. 1
0
    void LateUpdate()
    {
        // TODO: Place in update
        cursor.SetCursorLocation(mouseWorldPosition);

        Vector3 direction = cursor.GetCursorLocalPosition();
        float   angle     = Mathf.Atan2(direction.x, direction.y) * Mathf.Rad2Deg - 90.0f;

        toolTarget.localPosition = direction.normalized * 1.0f;
        toolTarget.localRotation = Quaternion.AngleAxis(angle, -Vector3.forward);
    }