Closed marked-one closed 10 years ago
Is it localPositionToGo.z = transform.localPosition.z;
in the last if?
Maybe I just woke up but I don't see how this code helps o.O
Yes, that's my fault, localPositionToGo.z = transform.localPosition.z;
is exactly what should be there. I just sent you a scene, which demonstrates what I'm talking about, to v@lent.in
In Transformer2D script it is better to replace
with
(or with better code, just change coordinates separately), if there are no strong reasons to keep it as it is.
The above changes solve the following problem for me:
I was using TouchScript to move a scene in a 2d game. I added PanGesture and Transformer2D script to the root object of a scene, and everything worked fine until I decided to limit the scene movement to the camera bounds. When the object goes beyond bounds,I just default its position to the max (or min) allowed value in LateUpdate of another script.
And the problem is, when the object hits, for example, a bound in X-axis, and I then continue to move the object with a gesture in the same direction in X axis, and in whatever direction in Y axis simultaneously, it doesn't move in X axis (this is expected), but it also doesnt't move, or just moves to a small distance, in the Y axis (and normal movement is expected here).