Making object follow finger?
Hello! sorry for such a broad question, im EXTREMELY new to coding and unity.
I'm trying to make a 2d game where, you move a "pick" in a lock....I want it to follow your finger and rotate, with the tip staying in the middle of the lock, It can only move on a 180 degree angle, from left to right, then stops.....but I cannot find any tutorials or code that really explains it very well of what I have to do to achieve this.
any help would be very much appreciated ( even if it's just "Hey man, go learn some code you idiot" )
thanks
EXAMPLE OF WHAT I NEED pick can move like this : -O O O-
O = lock - = pick
$$anonymous$$aybe the "pick" could just be a line that is drawn, and its origin is always the center of the lock and its end point is where your finger is, with constraints of course.
Answer by AnduuXDD · Jan 04, 2016 at 04:16 PM
@vintar could this "line" be attached to the Sprite used as the pick?
Yes, check this out : http://docs.unity3d.com/$$anonymous$$anual/class-LineRenderer.html
Add a line render and set its start position to the lock, and dynamically set its end position at the finger position, but clamped to your liking. When the person lifts their finger when lock is not open yet, just keep drawing the line where they left the screen.
Your answer
Follow this Question
Related Questions
Input.GetAxis("Vertical") not working on Mobile Phone 1 Answer
Unity 2d android game How to "freeze" position on Y axis 1 Answer
Simple cell-based game goes bonkers when clicked on the edge of the cell 0 Answers
How can I change my player control method to use a touch screen ?? Pong-clone 2D 0 Answers