Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

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:
    277
    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

    Unity Technologies

    Joined:
    Jul 1, 2018
    Posts:
    61
    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:
    277
    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:
    277
    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.