- Home /
LeanTouch Move Prefabs Separately
I'm trying to use the Rotate/Scale/Translate scripts on a prefab, when I instantiate multiples of that prefabs, they are all moving at the same time when I touch the screen. Is there a way to separately distinguish the gameobject I want to choose to move with LeanTouch.
Answer by RajOTS · Jun 02, 2021 at 02:10 PM
I was actually able to figure this out using this document (https://learn.unity.com/tutorial/manipulating-objects-in-ar-with-lean-touch?uv=2019.4#604e822bedbc2a0d3ecc53cc).
Basically make sure you have the LeanTouch gameobject in your hierarchy, it must have LeanTouch. Lean Select By Finger and Lean Finger Down scripts on the gameobject. Then add a trigger on the Lean Finger Down script on the On Finger (LeanFinger) section. The trigger should be the LeanSelectByFinger.SelectScreenPosition.
Then on your prefab or gameobject that you want to manipulate, make sure you have the Lean Selectable By Finger script on the object. (I have the Pinch Scale, Rotate Axis, Drag Translate and Select By Finger scripts on my prefab)
Your answer is very useful! I have 9 gameobjects in my scene. When I select the first object, I can drag this object only. However, when selecting the second object, the first object moves as well. Next, when selecting the third object, all three objects move, etc.
I think the problem is that my Lean Selectable does not have an option 'Deselect On Up' as shown in the Unity Documentation. I don't know how to 'unselect' the gameobjects in another way.
My Lean object contains: Lean Touch, Lean Finger Down, Lean Select By Finger. There is a trigger on Lean Finger Down (LeanSelectByFinger.SelectScreenPosition. My gameobjects contain: Lean Drag Translate and Lean Selectable By Finger (I don't want to rotate/scale them). The Lean Drag Translate contains the AR Camera.
Answer by unity_MXGApNcapNfNLg · Jun 02, 2021 at 10:07 AM
@RajOTS Add LeanSelectable component to your objects and follow the documentation accordingly.
Your answer
Follow this Question
Related Questions
Help with LeanTouch not working 0 Answers
How to assign touch input (GUI texture) to Input Manager Horiz and Vert axes? 0 Answers
Lean Joystick gets stuck on disable 0 Answers
Multitouch events get stucked. 0 Answers
Differentiate swipe from tap android 0 Answers