Jump to content


Photo

target.facing doesn't work properly?


    3 replies to this topic

    #1 Ichiba

    Ichiba

      Newbie

    • Members
    • Pip
    • 3 posts

      Posted 15 October 2017 - 12:23 PM

      local target = windower.ffxi.get_mob_by_target("t")
      print(target.facing) 

      When using the above snippet of code, the value returned doesn't seem to always be generated the same way for all targets. Some report in a range from -pi to +pi, while others are from 0 to 2pi. It does not matter if it's a PC or NPC; those that report incorrectly will continue to do so repeatedly. Am I somehow using this function or interpreting its results incorrectly? Should I submit a bug report? Thanks.



      #2 Arcon

      Arcon

        Advanced Member

      • Windower Staff
      • 1189 posts
      • LocationMunich, Germany

      Posted 15 October 2017 - 03:57 PM

      This function merely returns the value as it is in memory, so if there's an inconsistency there, it's on SE's part. Is the [0;pi] range at least the same? As in, do mobs who return 0 always face in the same direction, for both types of mobs? If so, you can still use the same trigonometric functions on it. Our vectors library should also work fine with both ranges, so long as the orientation is the same.



      #3 Iryoku

      Iryoku

        Advanced Member

      • Windower Staff
      • 488 posts

        Posted 15 October 2017 - 04:11 PM

        If the [0, pi] range is the same for both, it's pretty easy to change one into the other too.

        local facing = target.facing
        if facing > math.pi then
            facing = facing - math.pi * 2
        end


        #4 Ichiba

        Ichiba

          Newbie

        • Members
        • Pip
        • 3 posts

          Posted 15 October 2017 - 11:23 PM

          It doesn't really matter to me since I already have things working correctly for my purposes. I just wondered if there was some reason for the inconsistency or if you wanted to fix something like that to make it consistent. It looks like enemies always face from 0 to 2pi, and your character from -pi to pi, but with NPCs or other PCs it can go either way with no real way to tell which it will use that I can see.






          1 user(s) are reading this topic

          0 members, 1 guests, 0 anonymous users