• kralk@lemm.ee
    link
    fedilink
    arrow-up
    15
    ·
    edit-2
    4 months ago

    I love Godot, I’ve followed some of the tutorials but I think I’m too stupid to ever understand vectors.

    • Aurenkin
      link
      fedilink
      arrow-up
      37
      ·
      4 months ago

      Keep at it! I’m sure you’re heading in the right direction

    • Quetzalcutlass@lemmy.world
      link
      fedilink
      arrow-up
      8
      arrow-down
      1
      ·
      edit-2
      4 months ago

      Godot has one of the better explanations of vectors and their uses in games in their documentation, if you haven’t checked that out yet. It focuses on their practical use rather than going deep into the mathematics (though there is quite a bit of that too).

      And if you don’t understand the math, the documentation also explains when and how to use specific methods, so you can still use it as a cheat sheet when working on your project even if you don’t fully understand vectors.

      (And you’ll probably have an “ah-ha!” moment when working with them yourself. Like a lot of math, vectors are much easier to understand with practical, non-abstract examples.)

      • Charzard4261@programming.dev
        link
        fedilink
        arrow-up
        4
        ·
        edit-2
        4 months ago

        Everything about this project is amazing, but the documentation is something else. It is written so perfectly concise and yet easy to understand, gives example code just when you’d need it (and 90% of pages have C# variants and includes notes on how it may differ!) and so you just walk away knowing exactly what to do, or with a link to another useful, beautifully written page with what you actually were looking for instead.

        I used to think Unity had good documentation, but now that I’ve seen this it’s just on a whole new level. It also genuinely makes me weep when I go back to work in a proprietary engine with such scarce notes that it’s easier to look for other places it’s used and spend a day writing your own for the poor souls who come after…

        TL;DR Whoever writes the docs, I love you

    • alessandro@lemmy.caOP
      link
      fedilink
      arrow-up
      4
      ·
      4 months ago

      If you ever played Pen&Paper Battleship as child, you already know what a Vector2 is (Vector2i more precisely), it just didn’t click yet.

    • catloaf@lemm.ee
      link
      fedilink
      arrow-up
      2
      arrow-down
      1
      ·
      4 months ago

      A vector is just a group of numbers. That’s literally all it is.

      But the most common use is to describe something in three dimensions, usually a point in 3D space (x,y,z), or motion (still x,y,z but those numbers are in meters per second or something). But you could also use it for a color (r,g,b).

      But what most people mean when they say “vector” is a set of three numbers, where two are direction and one is magnitude. You know how they’re usually represented by an arrow? The direction components determine which direction that arrow points, and magnitude is the length of the arrow. (In two dimensions, this would probably be degrees of rotation and distance, like in a polar coordinate system.)

      There are mathematical conversions you can do to translate one of those vectors into other forms. One popular one is a conversion to get the coordinates of the point at the top of the arrow.

      • weker01
        link
        fedilink
        arrow-up
        8
        arrow-down
        1
        ·
        4 months ago

        I can’t resist. I’ve been indoctrinated by my math classes: “A vector is an element of a vector field.”

        A bunch of numbers is not immediately a vector. To be a vector you need the defining functions of a vector field also. Like addition and scalar multiplication.

        • catloaf@lemm.ee
          link
          fedilink
          arrow-up
          6
          arrow-down
          1
          ·
          4 months ago

          In pure mathematics, that’s. In game engines, a vector is a data type, and you can stuff whatever the fuck you want in its components. Not saying you should, but you can.

          Generally they’re just used where they make sense, like the direction+magnitude example. RGB is a little weird until you realize that a color is really just a point in a 3D space along the red, green, and blue axes.