Answer the question
In order to leave comments, you need to log in
How to make collisions in 2D more realistic?
https://www.youtube.com/watch?v=O6RWGz0tzrw
It seems that I set Collision Detection - Continuous, but it's all the same
like
this
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
public class DND : MonoBehaviour, IBeginDragHandler, IDragHandler
{
public Transform transform;
public Vector2 vector2;
private void Awake()
{
transform = GetComponent<Transform>();
}
public void OnBeginDrag(PointerEventData eventData)
{
Debug.Log("OnBeginDrag");
}
public void OnDrag(PointerEventData eventData)
{
Debug.Log("OnDrag");
vector2 = Camera.main.ScreenToWorldPoint(eventData.position);
transform.position = new Vector3(vector2.x, vector2.y, 0);
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question