W
W
WasTabon2021-03-29 15:02:10
Unity
WasTabon, 2021-03-29 15:02:10

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

1 answer(s)
F
freeExec, 2021-03-29
@WasTabon

Who moves physics through the transform.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question