Search Unity

Question How to drag object between 2 position?

Discussion in 'Getting Started' started by Pollawat, Feb 7, 2022.

  1. Pollawat

    Pollawat

    Joined:
    Aug 27, 2016
    Posts:
    192
    Hello good sir, ma'am.

    I'm trying to create some kind of a gate that players can drag to open or close by the mouse.



    As you can see here I got "2 pos" object left and right and in the middle is the "drag me" object. So, I need to make the "drag me" object follow a mouse whenever I click it and drag it to pos1 or pos2.

    I'm googling this for a day now and I will continue to do so.. but if the community can help that would be wonderful.


    Thank you.

    Edit: I need the "drag me" object to stick with the mouse, not just slide to the end and slide back.
     
    Last edited: Feb 7, 2022