W
W
WasTabon2021-03-30 14:07:28
Unity
WasTabon, 2021-03-30 14:07:28

What is the name of the method that defines Clamping on an object?

public void OnDrag(PointerEventData eventData)
    {
        Debug.Log("OnDrag");
        vector2 = Camera.main.ScreenToWorldPoint(eventData.position);
        rigidbody2D.MovePosition(vector2);
    }


And that is, here is such a code and it seems to work, but if you stop moving the mouse, the object starts to fall. And on the Internet there is only info and pressing

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
Fallerwood, 2021-03-30
@Fallerwood

You can try to track the position of the mouse and make a timer. If for example 2 seconds the mouse does not change its position or does not change much from the previous point, then the object falls. Try this logic

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question