Search Unity

Question How do I do random movement with VS?

Discussion in 'Visual Scripting' started by grkpektis, Mar 9, 2023.

  1. grkpektis

    grkpektis

    Joined:
    Mar 24, 2016
    Posts:
    10
    I have a character I want to move around the map randomly until he's clicked on using Visual Scripting. I already added a navmesh
     
  2. Auger

    Auger

    Joined:
    Jun 30, 2014
    Posts:
    9
    You can use the Random insideUnitCricle node for that. It will return a random spot in a circle with a radius of 1.0 Then just multiply that by a value for a bigger radius. Then construct a new vector 3 and set that as your navmesh destination. So if you want your character to go to a random spot a max 20 units from his present spot use 20 as your value. See the Pic for how I have it set up
     

    Attached Files: