- Home /
How to drag or slide an object on a line using touch or mouse, while it can go forward, back,up or down ?
hey, everyone, I am a beginner who doesn't know that much about c# but i am learning c# to make games but, I don't know how I can slide or move an object on a line that is like a plus sign."+" so if I am at the center of the plus I want to move freely on any direction, that is: up, down, forward or back, but not outside of the line...
you should implement an initial threshold that locks the drag onto an initial axis. it's your choice of that's any movement at all or a certain drag during which the object does not move at all because it could be diagonal and has not distinguished yet. from the point that you know it was more one or the other axis it's just a matter of only adding that certain axis from the mode to the movement, say mouse x to movement x.