Search Unity

Moving 3D object to another position

Discussion in 'General Discussion' started by thuiyang, Apr 30, 2020.

  1. thuiyang

    thuiyang

    Joined:
    Apr 14, 2020
    Posts:
    4
    Greetings,
    I'm freshie on Unity. As you can see from the figure below, I am developing an AR application. There are few 3D objects I have imported, 1 of them have meshes(Is this what we call?). For now I need to create a function button from UI that can lets these meshes go to another position. Every single mesh will go to different position. Is this possible?
    upload_2020-4-30_12-5-20.png
    Example:
    upload_2020-4-30_12-9-14.png upload_2020-4-30_12-11-21.png
     

    Attached Files:

  2. thuiyang

    thuiyang

    Joined:
    Apr 14, 2020
    Posts:
    4
    I don't know how the button interacts with the 3D meshes....what script should I create and where to put them...Need some tips..

    I have some ideas like, putting script into mesh.
    If button = true
    then
    transform.position
    But how to recognize/define the button?
     
    Last edited: Apr 30, 2020
  3. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,160
  4. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,573
    Yes, it is possible.
    "myObject.transform.position = newPosition;"

    I suggets to read some GUI tutorials.
     
  5. newjerseyrunner

    newjerseyrunner

    Joined:
    Jul 20, 2017
    Posts:
    966
    Your button can either be a 3D object in the scene, or a UI object on a Canvas.