Search Unity

Question How to ' get ' the position of another node in the inspector . . .

Discussion in 'Visual Scripting' started by vintage-retro-indie_78, Mar 15, 2023.

  1. vintage-retro-indie_78

    vintage-retro-indie_78

    Joined:
    Mar 4, 2023
    Posts:
    285
    Need to find the distance between the player, and another object, or ' entity ', is there an easy way to do this, etc etc . . .
     
  2. jeromeatunity

    jeromeatunity

    Joined:
    Jul 1, 2018
    Posts:
    63
    Math > Vector3 > Distance(A, B) should help you get the distance between 2 objects using their Transform > Position.

     
  3. vintage-retro-indie_78

    vintage-retro-indie_78

    Joined:
    Mar 4, 2023
    Posts:
    285
    no, this was what looking for, some boxes have something called ' this ', for the selected node, or entity, needed to make a ' Find -- Game Object ' box, and then type the name of another node . . .

    upload_2023-3-29_1-17-34.png

    that way, could find distance between for instance a turret, and also the player, and use that for making the turret turn toward player within some distance, or also trigger creatures, or ' enemies ' to look for the player - character, etc etc . . .

    #thx, Unity visual scripting is very, very good, think it's a nice experience, also quite advanced . . . . :) :cool:
     
  4. vintage-retro-indie_78

    vintage-retro-indie_78

    Joined:
    Mar 4, 2023
    Posts:
    285
    also, later going to add a raycast // no-clipping camera, and should have a basic Tomb Raider - classic, have to admit Unity is making it nice, also quite easy for people that don't want to // know how to code, #thx for adding visual scripting, my goal is also to learn C# however this ' visual ' coding makes it bit easier for beginners, etc etc . . .

    :) :D . . . .
     
    jeromeatunity likes this.