Search Unity

Resolved Pointing to mouse (Top down 2D)

Discussion in 'Visual Scripting' started by Norm49, Jun 8, 2021.

  1. Norm49

    Norm49

    Joined:
    Jun 7, 2021
    Posts:
    12
    Hi i am trying to make the player point at the direction of the mouse using visual scripting.

    After 5 hour i am defeated and I have to ask of help.
    How can I possibility do this?

    Thanks for your help.
     
  2. fffMalzbier

    fffMalzbier

    Joined:
    Jun 14, 2011
    Posts:
    3,276
    In most cases raycasting is a good way to figure out what / what world position is under your mouse position.
    Then you can use look at to point the object of your choice to the target position.
     
  3. Norm49

    Norm49

    Joined:
    Jun 7, 2021
    Posts:
    12
    Ok apparently something went wrong with one of the node. I just delete everything and redo the exact same ting using dose screen shoot i made before deleting the script as a reference and it work. Apparently if you copy a node and modify it after the node stoop working. I just lost 4 days on this when it should have take my 10 minutes :mad:, welcome to my normal life :(. Any ways now it work.

    Thanks for your time fffMalziber!

    This is how to do it, if other people need the help.



     
  4. irny

    irny

    Joined:
    Jul 22, 2015
    Posts:
    5
    This was really helpful, thanks!
     
  5. Brandty975

    Brandty975

    Joined:
    Dec 21, 2022
    Posts:
    1
    Holy crap this still works YEARS later