Announcement

Collapse
No announcement yet.

Struggling to understand basic vectors

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    Struggling to understand basic vectors

    Hi.

    I'm trying to get the angle between two different vectors. But man, that ancient mystery, passed from generation to generation, is something I can't figure out by myself.
    I've tried to draw a debug line between two vectors, a fixed one as a Start and a moving one as an End, but the result is garbage. Also, I have the WorldLocation of both normalized, then Dotted and finally aCOS them. But with the same exactly no-sense result.

    Could someone point me the right direction? (well said)

    To clarify: I need to measure the angle between a fixed vector and a moving VR controller in each of the 3 axis. The debug line was just to understand what I was doing wrong.

    Regards!





    Last edited by plasma_450; 07-12-2019, 05:31 AM.

    #2
    Sounds like you could use
    Code:
    Find Look at Rotation
    . It will return the Yaw and Pitch to the target in degrees.

    Comment


      #3
      aCos gives poor results if your two vectors don't share a common point.

      Comment


        #4
        The thing is: how do you measure the a/c angles? Both have forward, top and right vectors parallel. The Find Look and Rotation gives me strange values.

        Thanks!

        Comment


          #5
          You shouldn't care about angles at all but calculating dot product between both vectors X normalized axis.
          That value between -1.0 and 1.0 will tell you whether both vectors are aligned or looking opposite to each other. You could then convert that to angles, but really not needed.
          | Savior | USQLite | FSM | Object Pool | Sound Occlusion | Property Transfer | Magic Nodes | MORE |

          Comment


            #6
            A whole bunch of trig functions are available - essentially you just need to study up some trig.

            The reason you may be having trouble understanding could be the fact that the values in unreal are often not Rad nor Deg.

            there are specific functions to convert to rad or deg like atan2deg or aran2rad.
            Pretty much any trig function has both rad and deg as options.


            The other issue could be that you may be reading a bone rotation which is in a different rotational value then whatever else you are comparing to. Normalize should help with that but it might also not (you have to choose the correct normalize to normalize what you are looking at).

            Generally speaking - for the math part - even if you have 1 vector you can always compare it to it's normal.

            that vector would be 0,0,1 or 0,0,-1.

            If you dot product between A vector and 0,0,+-1 you should obtain the world related angle in... I want to say radians, but I may be off on that.

            Also, the value of B in your graph is 90.
            the value of the sum of all angles is 180.
            so your A and C angles can really only be inverse of each other on a range from 1 to 89.
            not that that helps, but it makes reasoning on how to solve them a bit easier when you look up the rules....

            Comment


              #7
              Originally posted by MostHost LA View Post
              A whole bunch of trig functions are available - essentially you just need to study up some trig.
              You are right. And that's the root problem as a matter of fact. Most of us amateurs have to deal with three, four or more balls in the air at any given time. If not basic trigonometry or basic logic, translating whatever mess you have in the head to oop without mastering any of the required tools. Being said that, this is a tour de force and you have to start somewhere. In my case, solving this very first problem will hopefully refresh everything I learned about tri at school and will help me to acquire some skill for the future.

              All the lazy question was about this, finding angles between vectors seems to be a very common calc and I thought one of those thousands unreal's little boxes implement that as fancy as Find Angle Between Vector, with and input Angle 1 and Angle 2 and an XYZ output in degrees Too good to be true.

              I'm remembering the Dot product, the acos and the atan right now... let's see how that fits inside my blueprint.

              Thanks for the info!

              Comment

              Working...
              X