Search Unity

  1. Get all the Unite Berlin 2018 news on the blog.
    Dismiss Notice
  2. Unity 2018.2 has arrived! Read about it here.
    Dismiss Notice
  3. We're looking for your feedback on the platforms you use and how you use them. Let us know!
    Dismiss Notice
  4. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  6. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  7. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  8. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

slow down slider using 2d physics?

Discussion in '2D' started by davejones1, Mar 13, 2018.

  1. davejones1

    davejones1

    Joined:
    Jan 19, 2018
    Posts:
    183
    I am trying to slow down the speed at which the ui slider moves. Is it possible to do this with 2d physics? IMG_1898.jpg IMG_1898.jpg
     
  2. Cucci_A

    Cucci_A

    Joined:
    Jan 23, 2018
    Posts:
    239
    No. UI components are not influenced by the physics engine.
     
  3. davejones1

    davejones1

    Joined:
    Jan 19, 2018
    Posts:
    183
    How would I change the speed at which the slider moves?
     
  4. Cucci_A

    Cucci_A

    Joined:
    Jan 23, 2018
    Posts:
    239
    I don't have an answer for that at the moment. Haven't experimented much with UI in Unity yet.
     
  5. davejones1

    davejones1

    Joined:
    Jan 19, 2018
    Posts:
    183
    Ok no problem, thanks for your reply. If you manage to find a solution do please get in contact with me.
     
  6. jeffreyschoch

    jeffreyschoch

    Joined:
    Jan 21, 2015
    Posts:
    2,292
    What do you mean by "slow down the slider"? Like you click and drag it, and it doesn't follow the mouse 1 to 1? Like it lags behind?

    What is this for? Does it really need to be a UI Slider?
     
  7. davejones1

    davejones1

    Joined:
    Jan 19, 2018
    Posts:
    183
    Slow down as in when the slider is dragged it can only be dragged at a certain speed. So yes I suppose in a way doesn't follow the mouse. The slider is used to scrub through an animation. At the moment the slider can be dragged quickly and the animation plays rapidly. I want to limit the speed at which the slider can be dragged so that the animation is played smoothly.
     
  8. Varishaa

    Varishaa

    Joined:
    Feb 19, 2018
    Posts:
    16
    What about moving the slider with key input in small steps?
     
  9. davejones1

    davejones1

    Joined:
    Jan 19, 2018
    Posts:
    183
    The slider is for touchscreens.
     
  10. Varishaa

    Varishaa

    Joined:
    Feb 19, 2018
    Posts:
    16
    use the gyroscope :) .. Sry no idea how you can do it else, except put additional buttons on it to get the "key" input.
     
  11. davejones1

    davejones1

    Joined:
    Jan 19, 2018
    Posts:
    183
    Not sure how to do this but thanks for the reply.
     
  12. Varishaa

    Varishaa

    Joined:
    Feb 19, 2018
    Posts:
    16
    Or what about getting the speed or distance of the touch input and put a factor on it and set slider manually? So it would require a script not linked to the slider button or at least not reacting to On... methods
     
  13. davejones1

    davejones1

    Joined:
    Jan 19, 2018
    Posts:
    183
    How would this be done?
     
  14. Varishaa

    Varishaa

    Joined:
    Feb 19, 2018
    Posts:
    16
    I didnt do it yet, so i cannot tell, but i am sure there is this option.
    At least the distance of a swipe should be possible to be calculated.
     
  15. davejones1

    davejones1

    Joined:
    Jan 19, 2018
    Posts:
    183
    The distance of the swipe can be found but creating the script is not.
     
  16. davejones1

    davejones1

    Joined:
    Jan 19, 2018
    Posts:
    183
    I realise that no one will know a solution to this problem, however it was worth a punt.
     
  17. davejones1

    davejones1

    Joined:
    Jan 19, 2018
    Posts:
    183
    UI components can be influenced by the physics engine. I added a 2d rigid body to the slider UI component and in play mode the slider was moving down the canvas as if it was under the influence of gravity.
     
  18. Cucci_A

    Cucci_A

    Joined:
    Jan 23, 2018
    Posts:
    239
    Really? That seems unusual. But hey, if it works...
     
  19. davejones1

    davejones1

    Joined:
    Jan 19, 2018
    Posts:
    183
    I still haven't managed to slow down the slider. I have just shown that UI elements can be influenced by the physics engine.