Hello,
i hope i type this in the right section.
I just started working with Unity and started following a Tutorial about something i wanted to try out.
This is the Tutorial im following
It is about Dragging stuff around. In the Video he uses a card game as an example.
My problem is, after i followed all the thing he did. That my “Card” is slower when i drag is than my mouse.
It is like the card has a rubber band attached to the ground whats pulling it back where it belongs.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
public class Draggable : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler
{
public Vector2 dragOffset = new Vector2(0f, 0f);
public void OnBeginDrag(PointerEventData eventData)
{
dragOffset = eventData.position - (Vector2)this.transform.position;
}
public void OnDrag(PointerEventData eventData)
{
this.transform.position = eventData.position - dragOffset;
}
public void OnEndDrag(PointerEventData eventData)
{
}
}
Note I thought it may maybe it has soemthing to do where i click the card. So i put something in the code so i can drag the card anywhere instead only in the middle of the card.
But that didn’t helped.
Maybe someone knows what’s up, and can help me.