Hi,
In my game I’m dragging my objects with mouse/touch and used some integer constraints with to limit where player can drag objects and it works just fine, here is the code that I put in each object’s update method:
void Update()
{
if (transform.position.x <= -65)
transform.position = new Vector3(-65, transform.position.y, transform.position.z);
else if (transform.position.x >= 48)
transform.position = new Vector3(48 , transform.position.y, transform.position.z);
}
Problem is if player drags the object out of the constraint, the object goes there and suddenly goes behind that constraint I put. It looks like the drag has a higher priority and first the finger moves the object to under player’s finger and then sees the update method call’s constraint and then moves the object back.
And if you keep your finger/mouse at that position beyond the constraint and move your finger a bit, same thing happens again.
How I can prevent this?
I’m using the “Advanced” method though, i.e. the one that I have my own Drag Gesture Recognizer and do not ask FingerGesture’s singleton.
Thanks in advance and any help would be highly appreciated.