Answer the question
In order to leave comments, you need to log in
How to constrain the movement of a 2D object in Unity3D?
Hello! There is a panel on which pictures of balls are located. Implemented movement trace. way:
public void OnDrag(PointerEventData eventData)
{
dot.transform.position = eventData.pointerCurrentRaycast.screenPosition;
//dot.transform.position = new Vector3(
// Mathf.Clamp(eventData.pointerCurrentRaycast.screenPosition.x, minPosX, maxPosX),
// Mathf.Clamp(eventData.pointerCurrentRaycast.screenPosition.y, minPosY, maxPosY),
// 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