Search Unity

Question How to get the number of the vertex closest to the object or recast or mouse position

Discussion in 'World Building' started by yairk333, Feb 18, 2021.

  1. yairk333

    yairk333

    Joined:
    Mar 26, 2020
    Posts:
    23
    How to get the number of the vertex closest to the object or recast or mouse position (Note I need the number of the vertex, not the position)

    cause i want to do that when I click on the mouse so the closer vertex move up so if you have other Ideas tell me pls
     
  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    Dude. Don't start a dozen threads on the same topic. That does not increase your chances of getting an answer; it just annoys the people who might know.
     
  3. yairk333

    yairk333

    Joined:
    Mar 26, 2020
    Posts:
    23
    ok. but.. How the hell to do that?!
     
  4. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    You would have to iterate over all the vertices, convert them from world to screen coordinates, compare to the mouse, and keep track of which is closest.