Search Unity

Can 2d physics be used to influence a UI slider?

Discussion in 'Physics' started by davejones1, Mar 21, 2018.

  1. davejones1

    davejones1

    Joined:
    Jan 19, 2018
    Posts:
    183
    I am interested in knowing whether UI sliders can be influenced by 2d physics.
     
  2. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,487
    It could but doesn't sound like a good use-case. For starters, it means your UI has to be in world-space which isn't common as it's typically in camera/screen-space.

    From your other post, it seems like you're simply after some physical behaviour like drag. Adding those things is much easier to do yourself via a simple script rather than trying to bind a rigidbody physics simulation to a UI.
     
  3. davejones1

    davejones1

    Joined:
    Jan 19, 2018
    Posts:
    183
    What simple script could be used to add those things?
     
  4. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,487
    davejones1 likes this.
  5. davejones1

    davejones1

    Joined:
    Jan 19, 2018
    Posts:
    183
    OK thank you for your response. All I am trying to do is use physics drag to limit the speed at which a UI slider can be moved.