Math for Game Devs [2022, part 3] • Matrix4x4 & Cross Product -

Math for Game Devs [2022, part 3] • Matrix4x4 & Cross Product

Freya Holmér
Views: 41289
Like: 768
Primarily for my students at FutureGames – I will only read chat/superchats during breaks!

Assignments here!! ❱

Find out more about the school at
❓ FAQ ❱

💖 Support me on Patreon ❱
📺 I usually stream on twitch ❱
💬 Join my discord ❱
🐦 Follow me on twitter ❱


  1. Didn't understand a single thing, but after watching this for three hours I was able to shoot one more baddie than usual in Halo 2.

  2. do transformation matrices need to have orthogonal basis vectors? that is, do the basis vectors of local space have to be orthogonal for our local-to-world transformation?

  3. I fell asleep and I woke up and this was playing

  4. I think unity it's not the best tool to explain and create real case scenarios. You should code outside game engines weather using opengl or directx api.

  5. Does anyone know where you can buy those 3D axis models she showed? Having a physical thing I can use as reference always helps and I can't draw 3D space to save my life.

  6. Lol, people paying 40$ for broken games, while you hiding so satisfying thing on your hard drive. Shame! Push it immediately!

  7. Really high quality content. Love your lectures!

  8. Even though I know my matrices it's nice to see the way you implement code. These are great!

  9. I… am so confused. I thought for sure you had made a mistake using column vectors in your 4×4 matrix instead of row vectors, so I tried making a modification in my own code to test it.
    I'm implementing a ladder in GZDoom's ACS script, so there's no built in matrices, not even 2d or 3d-vectors. It's all per element multiplication of arrays. Fun times!

    I want to transform the players position in world space to ladder space, as defined by a line(doom maps are drawn as top-down 2d) and I thought I had it all figured out after the last lecture "yesterday"(part 2).
    I got the delta subtracting a point on the middle of the line from the player's global coordinates, then
    I assign the ladder space x coordinate by multiplying the x-component of the ladder's right vector with the delta's x-component and add to that the product of the y-component of the ladder's right vector and the delta's y-component.
    (then basically the same for the y-component)

    But doing it like you're suggesting in this video, I should multiply the x-component of the ladder's right vector with the delta's x-component, then add to that the product of the x-component of the ladder's out vector and the delta's y-component…

    and it works.
    In fact, I get the exact same results.

    I don't even know how that makes sense.

    This should suggest that instead of scalar projection against each basis vector in turn, one could dot with the x-components(then y-components) of both basis vectors, and arrive at the same result?

    My brain is broken now.

    …wait, of course they're the same
    I literally made them the same value
    ladderRight is [cos(ladderAngle), sin(ladderAngle)] and
    ladderOut is [sin(ladderAngle), -cos(ladderAngle)]
    I've literally just flipped the "matrix" around the diagonal, haven't it…

  10. So, vector V's point of origin is P, and using the coordinate space of vectors x,y,z?

  11. Hello Freya! There is one thing that i don't understand. Maybe it's just because i don't have much experience with this stuff. My question is in the exemple as the minute 49:30 why should we calculate the offset in local space using the appropriate functions and than find the position in world space instead doing everything in global coordinates? (In short i don't undesrand if is necessary switching from local to global system). Thanks in advance!

  12. I tried to set the trasform.position of an gameobject equal to a vector4 (2,2,2,0) believing that the value of "w" set to 0 would not change the position of the object but only rotate it. Instead the object got the position of 2,2,2 in the global world. Was it me who misunderstood that "w" set to zero would just rotate the object or is there something strange?

  13. Blessed be the queen of programing, my here shining light touch all our source codes.

  14. At minute 52:12 the explanation is a little bit confusing because i think if we want to do what you are explaning (find a relative direction from us) we should use "InverseTransformDirection" instead and not TranformDirection. Using TransformDirection would be true only if the object that is calling TranformDirection is not rotated.

Leave a Reply

Your email address will not be published.