Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

LEAN ⚡️ Touch / GUI / Texture / Localization / Transition / Pool

Discussion in 'Assets and Asset Store' started by Darkcoder, Aug 1, 2019.

  1. Pourya-MDP

    Pourya-MDP

    Joined:
    May 18, 2017
    Posts:
    145
    I just want to set specific bools to true on touch began and false on touch end but as i mentioned in predifined areas.
     
  2. pradf4i

    pradf4i

    Joined:
    Nov 7, 2017
    Posts:
    39
    Hi DarkCoder, How can we access the 'On Finger event' in LeanFinger swipe from script? Do you have any examples for this? Thanks
     
  3. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,406
    This will be added to the next version. Currently you can only detect when a finger begins touching down on a UI element, or which fingers are.


    You can store a reference to your LeanFingerSwipe component as a public field, and then: yourLeanFingerSwipe.OnFinger.AddListener(yourFingerSwipeHandler)

    Also .RemoveListener(...), you can call these from OnEnable and OnDisable.
     
  4. dox

    dox

    Joined:
    Mar 8, 2011
    Posts:
    58
    Hello @Darkcoder , we've just purchased your assets, and when importing to clean project opening zoom example scene we've got null references errors. Tested in Unity 2020 & 2019 URP.

    Also is it possible to zoom using transform not FOV?

    Do you know what could be the issue? Thanks
    upload_2020-11-18_14-52-2.png
     
    Last edited: Nov 18, 2020
  5. krzysztofjankowski

    krzysztofjankowski

    Joined:
    Sep 29, 2020
    Posts:
    1
    @Darkcoder I'm from the same team as dox and I found that removing line 231 from \Lean\Touch+\Scripts\LeanPinchCamera.cs make the error disappear. Of course now I can not change damping value.

    Other problem we're having is that setting mouse buttons to anything than 0 the component stops working (for touch also).

    What I came up is this setup. Values in parenthesis are Requied Finger Count / Requied Mouse Button.
    - camera have Maintain Distance + Multi Pinch (0/0) + Mouse Wheel - this works
    - pivot have Pitch Yaw + Multi Update (1/0) + Drag Camera (2/0)

    But when I run and simulate touches using alt+LMB I got drag and shift+LMB I got orbiting witch is opposite to what I setup. EDIT: I checked on real touch device and the mappings are as I setup. But when I changed them to Drag Camera to 1 touch and Multi Update to 2 touches the pinch is working strange. In the end it's still something wrong.

    We just want to have:
    - one touch / LMB as drag
    - two touches / RMB as orbit (rotate)
    - pinch / scroll as zoom (using distane not zoom)

    What should I change to accomplish this?
     

    Attached Files:

    Last edited: Nov 18, 2020
  6. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,406
    Sorry for the late reply, I answered you via email.



    If I set up a scene as you describe (see attached), it seems to work as expected:
    - LMB = drag
    - Alt + RMB = orbit
    - Wheel or Ctrl + Drag = zoom

    It might be useful to have an option to ignore the RequiredFingerCount if the RequiredMouseButton is set, then you wouldn't have to press Alt, but other than this it seems to work?
     

    Attached Files:

  7. dox

    dox

    Joined:
    Mar 8, 2011
    Posts:
    58
    Hello @Darkcoder

    Thanks.

    Just checked my email didn't receive any email yet.
     
  8. maksymr

    maksymr

    Joined:
    Jan 31, 2015
    Posts:
    9
    Hi. I bought LeanTouch+. I saw it's possible to recognize swipes in 8 directions which is one thing I need but could you tell me if it's possible to recognize: SWIPE + HOLD in certain direction and if player is still holding the finger on screen? My character moves on swipe but I want him to move continously on SWIPE + HOLD. Thanks for the answer.:)
     
    Last edited: Nov 26, 2020
  9. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,406
    Yes. LeanTouch+ comes with the LeanFingerFlick component, which works like LeanFingerSwipe in the free version, but it instantly detects the swipe even if your finger is still on the screen. When this event triggers it has the OnFinger event, which can be used to send this finger to your custom component to perform some custom action until the finger goes up, or you can send it to a component like LeanMultiUpdate which can give you information like the current position of this finger after it flicked without any code, etc.
     
  10. maksymr

    maksymr

    Joined:
    Jan 31, 2015
    Posts:
    9
    That sound good! I am gonna check it right now and let you know how it went.
    But I wonder because what I basically do is:
    1. Swipe to move
    2. If player holds then continue movement
    3. If player changes direction during movement then the character should react and change movement direction.

    I wonder if LeanFingerFlick is what I need or I should use something else (drag maybe?)

    Thank you for quick response!
     
    Last edited: Nov 26, 2020
  11. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,406
    Oh I see. In this scenario you might want to use LeanMultiPull, which kind of works like a joystick and gives you the vector between the finger start and current positions, allowing you to apply this as a translation or velocity. There's currently no setting to clamp this value to say 0..1 though. If you just want t a joystick then you may want to look at LeanJoystick in the LeanGUI asset, which has actual on screen joysticks you typically see in mobile games.
     
  12. pvalium

    pvalium

    Joined:
    Oct 1, 2016
    Posts:
    29
    Hi,
    I have a scene with lean finger tap, and lean selectables in all touchable controls. All runs ok.
    I would want to use finger down in some controls, and finger tap in other controls. For ex, I want finger tap in objects of inventory, but I want finger down in close window controls, buy/sell buttons, etc.
    What is the best aproachment?
     
  13. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,406
    Your inventory and buy/sell buttons are probably UI elements, so they should have no impact on the tap to select and LeanSelectable features. If you're using some sort of complex mix then you can try using LeanSelectSelf, which doesn't use the LeanSelect system, and allows you to do custom selection-like behavior. It depends on your exact scenario though.
     
  14. pvalium

    pvalium

    Joined:
    Oct 1, 2016
    Posts:
    29
    Oh, i think this component is perfect.
    One question: im using lean touch for all: ui and non ui. Is there any problem with this, or is best approachment use only for non ui?
    Thanks
     
  15. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,406
    If your UI components interact with the 2D/3D game world (e.g. drag and drop), then it can make sense to use LeanTouch for everything. If your UI is largely separate then you can use normal UI components or LeanGUI. It depends on what you're trying to do though.
     
  16. pvalium

    pvalium

    Joined:
    Oct 1, 2016
    Posts:
    29
    Ok, thank you!
     
  17. jiraphatK

    jiraphatK

    Joined:
    Sep 29, 2018
    Posts:
    293
    #Edit, just tested again and this worked :eek::eek::confused::confused:
    Is there a gotcha I need to beware of if I have 2 LeanSelect in the scene ?

    Hi, is it possible to have 2 lean select in the scene? I'm trying to use a different selecting method(CanvasUI and Raycast3D) but when there are 2 LeanSelects in the scene, the second one won't work.
    Right now my resolution is to switch LeanSelect's Raycast method manually in the script but it's hard to manage and bug-prone.
     
    Last edited: Nov 30, 2020
  18. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,406
    If you know what you're doing and don't make them conflict by calling them both at the same time then it will work. This is why the SuppressMultipleSelectWarning setting exists.
     
    jiraphatK likes this.
  19. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    Lean Pool is importing a script that doesn't compile:
    Assets\Lean\Common\Examples\Scripts\LeanCircuit.cs(16,8): error CS0103: The name 'Target' does not exist in the current context


    EDIT: nevermind, it's working now. I guess it was some kind of compilation order issue. I had to delete the whole LEAN folder and reimport
     
    Last edited: Dec 2, 2020
  20. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,406
    LeanCircuit was removed a while back, and Unity doesn't auto remove files that no longer exist, so you must either manually delete this, or delete the Lean folder and re-import.
     
  21. fabiotgarcia

    fabiotgarcia

    Joined:
    Apr 28, 2017
    Posts:
    35
    Hi there!
    I added Lean move and scale on my AR app. When user is recording the AR with NatCoder, and he moves the AR at the same time, the recording freeze. I'd like to stop the Lean plugin once the user click in the button to record. How can we do this?
     
  22. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,406
    Try the attached package. The LeanTouch component now includes the Clear() method, which you can call and it should act as if you stopped touching the screen. You can then disable the LeanTouch component and activate it again once your recording has finished. I didn't test it though, so maybe there's some unexpected issue.
     

    Attached Files:

    fabiotgarcia likes this.
  23. fabiotgarcia

    fabiotgarcia

    Joined:
    Apr 28, 2017
    Posts:
    35
    Thank you! I'll try it.
     
    Darkcoder likes this.
  24. slimshader

    slimshader

    Joined:
    Jun 11, 2013
    Posts:
    187
    Hey! Is there a way to detect a swipe gesture but only in the part of the certain area of the screen?
     
  25. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,406
    If you're using LeanGUI you can use the LeanSwipe component (Lean/GUI/Exmaples/24).

    If you're using LeanTouch+ you can use the LeanFingerDownCanvas and LeanManualSwipe components (Lean/Touch+/Examples/Canvas/03)
     
  26. slimshader

    slimshader

    Joined:
    Jun 11, 2013
    Posts:
    187
    LeanSwipe from LeanGUI works great, thanks!
     
    Darkcoder likes this.
  27. fabiotgarcia

    fabiotgarcia

    Joined:
    Apr 28, 2017
    Posts:
    35
    Thank you! It worked perfectly!
     
    Darkcoder likes this.
  28. Looping_co

    Looping_co

    Joined:
    Dec 10, 2016
    Posts:
    19
    Hi,
    I use Lean GUI with Bolt Visual Scripting. I use the "Swipe Screen" example. I want to active/deactivate some stuff based on which screen I see on screen. Is it possible to have access to the current screen value (screen 1 = int 0; screen 2 = int = 1; etc..) ?
    Thank you,
     
  29. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,406
    This will be available in the next version. I'll send you an early copy of it to test.
     
    Looping_co likes this.
  30. Blarp

    Blarp

    Joined:
    May 13, 2014
    Posts:
    269
    How can I use horizontal and vertical arfoundation raycast with Lean Touch?

    Having problems just including: using UnityEngine.XR.ARFoundation; in LeanDragTranslate
     
    Last edited: Dec 14, 2020
  31. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,406
    No idea, what does this feature do? and how are you trying to integrate it into LeanDragTranslate?
     
  32. maltakereuz

    maltakereuz

    Joined:
    Mar 29, 2015
    Posts:
    53
    Hi, i want to move my Localization phrases out of scene into prefabs, to use across multiple scenes. I have heavily used forward slashes to organize my translations into groups. Unfortunately prefabs are not allowed to have slashes in names, so i need rename phrases like Items/Swords/Sword1 into Items.Swords.Sword1 or like this. Here comes some problems:

    1) Can i somehow use another delimiter instead of forward slash to have groups in List button?
    2) I probably need to rename all phrases, can i preserve old phrase names in code/scenes? Or i need to find and rename them all manually now? (there are pretty many of them i am not sure anymore where to find them). Can this step be somehow automated?
    3) Maybe i am doing it somehow wrong and to complicated and there is better solution? Basically i just have pretty much phrases with slashes and want to use prefabs now.

    upd: well i looked inside source code, at least i can threat any symbol (dot in my case) as slashes. As far as i understood slashes are not some feature of LeanLocalization, but a built-in functionality of GenericMenu in Unity-GUI.
    Code (CSharp):
    1.  
    2. LeanTranslationNameDrawer.cs
    3.  
    4. (line 63)
    5. foreach (var translationName in LeanLocalization.CurrentTranslations.Keys) {
    6.     var a = translationName;
    7.     if (a.Contains(".")) {
    8.         a = a.Replace(".", "/");
    9.     }
    10.     menu.AddItem(new GUIContent(a), property.stringValue == translationName, () => { property.stringValue = translationName; property.serializedObject.ApplyModifiedProperties(); });
    11. }
    12.  
    13.  
     
    Last edited: Dec 17, 2020
  33. Maikibu

    Maikibu

    Joined:
    Jan 1, 2017
    Posts:
    1
    How can I make something happen at the end of a transition?

    For example, my pause screen currently uses a few joined animations to slide the menu's parts out of the screen. How can I disable them after the process is complete?
     
  34. gregacuna

    gregacuna

    Joined:
    Jun 25, 2015
    Posts:
    59
    I bought Lean Touch+ as part of a package earlier in the year, but only getting around to using it and somethings are extremely easy and other difficult and confusing. Here's what I'm trying to do...

    I have two elements in the same scene which I would like users to be able to touch and drag around on Android and iOS. One is an 3d Avatar character and the other is a UI Speech Bubble. So the idea is users will be able to move the avatar and place the speech bubble how ever they want.

    I have the Lean Touch component in the Hierarchy. Then I placed the the Lean Drag component on the UI element and it immediately worked. Then I tried a variety of options for dragging the 3d Game Object (Avatar) and the closest to working is Lean Drag Translate. When I drag the Avatar it moves by itself...BUT...when I drag the Speech Bubble (UI Element) it moves both the Speech Bubble and the Avatar.

    I'm guessing I need to implement some kind of selection so only one of the elements I want to move is selected at the same time, but I've looked through the examples and just can figure it out.

    Any suggestions...Please!!! :)

    I'm using Unity 2019.4.15 with Lean Touch+ 2.2.1
     
  35. dzalavadiya97

    dzalavadiya97

    Joined:
    Nov 14, 2019
    Posts:
    6
    Can anyone help me with Sticker functionality with Two camera where 1st cam is used for Recording render texture to other raw Image(This raw image is inside Canvas) and Second camera is used to render Canvas.
    Now here I want to develop sticker functionality to do Rotate,Scale and Drag and drop.
    Can anyone help me with How can I achieve this, I stuck into these since last 2Days.!
    Any help would be appreciated :)
     
  36. toddkc

    toddkc

    Joined:
    Nov 20, 2016
    Posts:
    207
    It seems like Lean Pool is broken. It was working fine, and I just noticed an update, so I updated. Now when I make a game object pool with a preload amount the gameobjects are created and persist after exiting playmode, but they are also all enabled rather than disabled.
    (I haven't read through many previous posts to see if this has been mentioned)
     
  37. jimmying

    jimmying

    Joined:
    Sep 20, 2017
    Posts:
    107
    FYI I think there might be a problem with the Constrain To Direction functionality. Demo ("06 Constrain To Direction") scene doesn't look like it's working in 2.2.1. Tested in 2019.2.10f1
     
  38. shacharoz

    shacharoz

    Joined:
    Jul 11, 2013
    Posts:
    98
    hello,
    Lean Touch is a great asset.
    just wanted to say that I wrote a new mechanism and perhaps someone else will be interested in it.

    this mechanism will rotate an object around the X and Y if user will drag a finger (no twist gesture needed).

    here is the code:

    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. namespace Lean.Touch
    4. {
    5.     /// <summary>This component allows you to translate the current GameObject relative to the camera using the finger drag gesture.</summary>
    6.     [HelpURL(LeanTouch.HelpUrlPrefix + "LeanDragRotateAxis")]
    7.     [AddComponentMenu(LeanTouch.ComponentPathPrefix + "Drag Rotate")]
    8.     public class LeanDragRotateAxis : MonoBehaviour
    9.     {
    10.         /// <summary>The method used to find fingers to use with this component. See LeanFingerFilter documentation for more information.</summary>
    11.         public LeanFingerFilter Use = new LeanFingerFilter(true);
    12.  
    13.         /// <summary>The camera the translation will be calculated using.\n\nNone = MainCamera.</summary>
    14.         [Tooltip("The camera the translation will be calculated using.\n\nNone = MainCamera.")]
    15.         public Camera Camera;
    16.  
    17.         /// <summary>The sensitivity of the translation.
    18.         /// 1 = Default.
    19.         /// 2 = Double.</summary>
    20.         [Tooltip("The sensitivity of the translation.\n\n1 = Default.\n2 = Double.")]
    21.         public float Sensitivity = 1.0f;
    22.  
    23.         /// <summary>If you want this component to change smoothly over time, then this allows you to control how quick the changes reach their target value.
    24.         /// -1 = Instantly change.
    25.         /// 1 = Slowly change.
    26.         /// 10 = Quickly change.</summary>
    27.         [Tooltip("If you want this component to change smoothly over time, then this allows you to control how quick the changes reach their target value.\n\n-1 = Instantly change.\n\n1 = Slowly change.\n\n10 = Quickly change.")]
    28.         public float Dampening = -1.0f;
    29.  
    30.         /// <summary>This allows you to control how much momenum is retained when the dragging fingers are all released.
    31.         /// NOTE: This requires <b>Dampening</b> to be above 0.</summary>
    32.         [Tooltip("This allows you to control how much momenum is retained when the dragging fingers are all released.\n\nNOTE: This requires <b>Dampening</b> to be above 0.")]
    33.         [Range(0.0f, 1.0f)]
    34.         public float Inertia;
    35.  
    36.         [HideInInspector]
    37.         [SerializeField]
    38.         private Vector3 remainingTranslation;
    39.  
    40.         /// <summary>If you've set Use to ManuallyAddedFingers, then you can call this method to manually add a finger.</summary>
    41.         public void AddFinger(LeanFinger finger)
    42.         {
    43.             Use.AddFinger(finger);
    44.         }
    45.  
    46.         /// <summary>If you've set Use to ManuallyAddedFingers, then you can call this method to manually remove a finger.</summary>
    47.         public void RemoveFinger(LeanFinger finger)
    48.         {
    49.             Use.RemoveFinger(finger);
    50.         }
    51.  
    52.         /// <summary>If you've set Use to ManuallyAddedFingers, then you can call this method to manually remove all fingers.</summary>
    53.         public void RemoveAllFingers()
    54.         {
    55.             Use.RemoveAllFingers();
    56.         }
    57.  
    58. #if UNITY_EDITOR
    59.         protected virtual void Reset()
    60.         {
    61.             Use.UpdateRequiredSelectable(gameObject);
    62.         }
    63. #endif
    64.  
    65.         protected virtual void Awake()
    66.         {
    67.             Use.UpdateRequiredSelectable(gameObject);
    68.         }
    69.  
    70.         protected virtual void Update()
    71.         {
    72.             // Get the fingers we want to use
    73.             var fingers = Use.GetFingers();
    74.  
    75.             // Calculate the screenDelta value based on these fingers
    76.             var screenDelta = LeanGesture.GetScreenDelta(fingers);
    77.  
    78.             if (screenDelta != Vector2.zero)
    79.             {
    80.                 // Perform the translation
    81.                 if (transform is RectTransform)
    82.                 {
    83.                    
    84.                 }
    85.                 else
    86.                 {
    87.                     Rotate(screenDelta);
    88.                 }
    89.             }
    90.         }
    91.  
    92.         /// <summary>The axis of rotation.</summary>
    93.         [Tooltip("The axis of rotation.")]
    94.         public Vector3 Axis = Vector3.zero;
    95.  
    96.         /// <summary>Rotate locally or globally?</summary>
    97.         [Tooltip("Rotate locally or globally?")]
    98.         public Space Space = Space.Self;
    99.  
    100.         private Vector3 _rotation = Vector3.zero;
    101.  
    102.         private void Rotate(Vector2 screenDelta)
    103.         {
    104.             // set rotation according to X and Y finger position
    105.             if (Axis.x != 0) _rotation.x = Axis.x * screenDelta.y * Sensitivity;
    106.             if (Axis.y != 0) _rotation.y = Axis.y * screenDelta.x * Sensitivity;
    107.  
    108.             // Perform rotation
    109.             transform.Rotate(_rotation, Space);
    110.         }
    111.     }
    112. }
     
  39. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,406
    Sorry for the late replies everyone!

    1 - Good point. There is one workaround though, and that is to make your prefab root empty, but add translations to its children which can have slashes in the name.

    2 - You need to find an replace them manually. I considered making a of tool to do this, but it's kind of risky to automate opening every scene and prefab and making these kinds of changes, not to mention these strings can be stored in many places which makes the code not fun to write and quite the opposite of 'lean'.

    3 - Just group them all under one GameObject, make it a prefab, and drop the prefab into the Prefabs and it should work as before:

    upload_2021-1-2_18-7-29.png

    You can add the LeanGameObjectSetActive transition, or use LeanEvent to do something entirely custom.

    You must implement selection to isolate the controls. The "Touch+/Examples/Selection/02 Select 2D+3D+UI" demo scene shows you one way to do this in 3D + UI. You can then use LeanDragTranslate and it will work on both. You can also use LeanTouch+ for the 3D, and LeanGUI for the UI. Keeping the main scene and the UI isolated is usually easier to manage.


    You'll have to provide more details on how your scene is set up, and how you expect the touch controls to work though these cameras.


    Thanks for pointing this out, that shouldn't be happening! I'll see if I can fix it.

    [Edit] Fixed - New version coming out soon!


    Indeed, I'll check it out!

    [Edit] Fixed - New version coming out soon!


    Nice!
     
    Last edited: Jan 2, 2021
  40. hellobard

    hellobard

    Joined:
    Sep 26, 2012
    Posts:
    140
    I’m new to Lean Touch + and have been going theough the examples the last few days. I am trying to recreate the Pokémon Go ball throwing and was wondering what you’d suggest to use for something like this:

    1. Select and lift ball
    2. Flick the ball towards target in 3D space
    3. Deselect ball
    4. Instantiate new ball
     
  41. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,406
    I don’t remember off the top of my head, but there’s a demo scene called something like “Grab Spin Throw” that shows you how to implement most of this. It doesn’t contain any respawning feature, but that should be easy enough to do with some custom code or visual scripting.
     
  42. hellobard

    hellobard

    Joined:
    Sep 26, 2012
    Posts:
    140
    Great, thank you! I will give that a whirl:)
     
    Darkcoder likes this.
  43. hellobard

    hellobard

    Joined:
    Sep 26, 2012
    Posts:
    140
    Quick update question;
    so I have it working quite to my liking, but it's hard to control the throwing. See this video:
    https://www.dropbox.com/s/nieo6vqi7pj3oqd/BallVideoRecording.mov?dl=0

    The ball keeps getting thrown out of screen and not directly forward. Using the LeanManualTranslateRigidbody script it was much easier to control different methods for how input was handled. Can I switch Lean Drag Rigidbody with this somehow or could the aforementioned script get these options in the future?
     
    Last edited: Jan 3, 2021
  44. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,406
    Yes, you can use LeanManualTranslateRigidbody for this and it should work similarly. If you tried this component earlier I'm not sure what the issue was. Do you have an example video of the kind of movement you're expecting to see?
     
  45. hellobard

    hellobard

    Joined:
    Sep 26, 2012
    Posts:
    140
    So sorry, but I just realized I was referring to the wrong script!
    I was actually referring to the Screen Depth options in "Lean Finger Swipe" and "Lean Drag Line". So here's the Lean Finger Swipe and Manual Translate Rigidbody combo that works really well:

    https://www.dropbox.com/s/yudxfli9pshpmg1/RecordingLean.mp4?dl=0

    Very happy with this, and I basically just want to add the ability to pick up the ball and move it around before one flicks it forwards like in the swipe example video above. The Lean Finger Swipe settings are set to Screen Depth: Physics Raycast using the Main Camera.

    Edit with fix:
    Managed to fix this by using the Grab Throw example and adding a On Deselect event that talks to LeanManualTranslateRigidbody.TranslateA and setting the values to adjust the Y and Z values. Makes it work exactly as I wanted :)
     
    Last edited: Jan 4, 2021
    Darkcoder likes this.
  46. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,406
    Glad you found a solution, this looks fantastic!
     
  47. HyperboxGamesOffical

    HyperboxGamesOffical

    Joined:
    Aug 7, 2020
    Posts:
    1
    Lean Touch+ Hi, I would like to rotate an object in every number of degrees with dial script. Do any of you found a solution to rotate in some number of degrees in Lean Touch+ Dial Script?
     
  48. cyberjj999

    cyberjj999

    Joined:
    Nov 30, 2020
    Posts:
    4
    [ IF THIS QUESTION IS TOO LONG, PLEASE JUST LOOK AT LAST LINE OF MY QUESTION ]
    {The majority of the text below is just me explaining what I've tried}


    Hi guys, I am using LeanTouch and I have the LeanSelectable script on 2 different objects.
    1) Canvas UI (Text UI)
    2) 3D Object (Cube)
    For the Canvas UI, I am also adding LeanDragTranslate - the idea is that every time users select my Text UI, they can move it by dragging it around
    To allow my Text UI to be selectable, I also have a (Basically a game object with LeanSelect and LeanFingerTap and set the Select Using to "Canvas UI")

    And for some strange reasons, I'm not able to select or drag the Text UI around unless my LeanTouch object excluded "UI" in the GUILayers, since its not a big deal I decided to exclude the "UI" checkbox in the GUI Layers.

    Next, to make my 3D Object selectable, I had to create another "Tap to Select (3D)" (Basically a game object with LeanSelect and LeanFingerTap - you can find this at Example Scene 19) and set the Select Using to "Raycast 3D"
    Now my text is able to move well and I can select the 3D Object.
    The problem now is that while any of my UI are active (be it a panel or whatever) when I tap on the panel, the raycast can actually pass through and hit the 3D Object Cube, which is not supposed to happen. I am aware that the solution is checking the "IgnoreStartedOverGUI" on the "Tap to Select (3D)" object, but the issue is that, since my LeanTouch object doesn't have the "UI" GuiLayer, the "IgnoreStartedOverGUI" doesn't seem to work.

    I apologize for the long message, but my primary question has to do with - how can I ensure that both Canvas UI and 3D Objects can be selected. Also ensuring that when my UI is active, i.e. when I have a panel blocking a cube, I should not be able to select the cube.
    Do I need to have 2 LeanSelect scripts on one object?
     
  49. cyberjj999

    cyberjj999

    Joined:
    Nov 30, 2020
    Posts:
    4
    [LeanTouch]
    Hi everyone, just to clean up my question yesterday

    How can I select both UI and 3D Object in my game, without my 3D Object being selected while my UI is on top of it?
    (i.e. if there's a panel infront of my 3D Object, touching the 3d object over the panel SHOULD NOT select the 3d object)
     
  50. gregacuna

    gregacuna

    Joined:
    Jun 25, 2015
    Posts:
    59
    Thanks for your response. I didn't get any notification so only seeing it today. Will check out the example you mentioned and see if I can figure it out.

    BTW...any plans to add Playmaker actions?