Swipe single object at a time upon touch, not swiping allover the screen
Hi! Im trying to inplement swipe functionality, to move object(s) in teh direction of the swipe. It works fine, my only problem is that I can swipe all over the screen (and not only over the object to swipe). Also all objects with the swipe scripts are moved at once, and not a single object that is swiped.
I tried using Raycast from camera and/or swipe object code, but I simply dont know how to access a hit object's code (object hit bu raycast). I need to have access to the hit object's code to change values in ONLY the hit instance of the object.
I will post a video of my problem as well as my code here:
Object Swipe Code (component to every swipable object):
My Raycast code (on camera):
Video: https://vid.me/hFPY
How can implement swipe ONLY over the oject (not on the entire screen) and how can I move a single object that is swiped at a time?
Thanks in advance!
Your answer
Follow this Question
Related Questions
Do touch on point where ray hits 0 Answers
RaycastHit2D problem 0 Answers
Why does my player not move towards the raycast hit in this script? 1 Answer
Detect a swipe left or right to move object? 0 Answers
RayCastHit 2d with layerMask not workin 0 Answers