Closed outfrost closed 6 years ago
Found out that totalDisplacement
in the snap animation code always has -10.0f
as the z
value.
This line in OnMouseDrag()
was the problem:
displacement.z = dragStartPosition.z;
Every time the player dragged a card, it would jump +10 units on Z and stay there until the transform position was reset to snapPosition
, due the z
value of 10.0f
in dragStartPosition
being accidentally doubled. Obviously, if a card was repeatedly dragged without reaching the snap position, the Z coordinate would continue increasing with each drag, eventually moving the card past the visible Z range.
Replacing the line with
displacement.z = 0.0f;
Fixed the issue.
Best reproducible by repeatedly dragging a card in the middle of its converging animation.
Dragging a card keeps the Z constant, but the smooth animation doesn't - probably the cause.