Math for Game Devs [2022, part 3] • Matrix4x4 & Cross Product
Вставка
- Опубліковано 25 жов 2022
- Primarily for my students at FutureGames - I will only read chat/superchats during breaks!
Assignments here!! ❱ acegikmo.notion.site/Lectures...
Find out more about the school at futuregames.se/
❓ FAQ ❱ acegikmo.notion.site/FAQ-8b62...
💖 Support me on Patreon ❱ / acegikmo
📺 I usually stream on twitch ❱ / acegikmo
💬 Join my discord ❱ / discord
🐦 Follow me on twitter ❱ / freyaholmer
Lecture starts here: 5:21
5:21 Matrices
56:00 Matrix Inversion
59:10 Last Row of the Matrix4x4
1:03:10 Break/Questions
1:36:09 Shows off game/Use cases for Dot product & Matrix transformation
1:44:25 Coordinates
1:48:47 Cross product
2:02:20 Break
2:10:30 Cross product use case
(Will add the rest when I finish the video)
Did you finished ? 👀
Blessed be the queen of programing, my here shining light touch all our source codes.
I fell asleep and I woke up and this was playing
Thanks for sharing this
Thanks
Really high quality content. Love your lectures!
That game looks similar to Data Wing. Love that one. Great video, I learnt a lot.
Hey, I would like to say thank you^^
It's really hard to navigate without chapters/timecodes, could you please add them?
Overall it's a great course, thank you very much!
Love how unread engine is on its own on the coordinate system chart 😂 (to be fair it's the most intuitive for me too, since probably im guessing xy on 2d and xy on 3d games is the same)
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.
there was a typo; it should have been M^-1*(v.y, v.x, v.z, 1), you should be able to replicate it by calling transform.TransformDirection()^-1, the inverse of a function could be represented as if f(y) = x, then putting y in the inverse of f should give you x. the previous section where she explained how multiplying a 4x3 matrix by a 1x4 matrix would give you local to world ,multiplying the by the inverse of the 4x3 matrix should give you world to local
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?
❤️❤️thx
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.
you can probably just make one yourself with some toothpicks, glue, and paint for color
49:00
1:26:30
1:40:50
1:44:50
1:53:30
Even though I know my matrices it's nice to see the way you implement code. These are great!
Ygiucx
Yho
Cx
😊
😊
Another remarkable representation of life and the world we live in. The more knowledge we accumulate the greater our abilities become to go on and do great things.
should I have fluency in unity to solve the assignments ?
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!
Hey Vincnet. In general it can be easier to reason through, and the math can be simpler, and better visualized when working in the local space coords. if you get a world space vector, you might have to do some Vector addition to get it in the proper spot. If you are just using local space coords, you know it will be in the correct spot without much thinking. Either way is valid, I think working in local space is just less mental overhead.
yep! I think I talk about this extensively during some of the assignment solution videos
@@samuelmorey9097 Thanks a lot for the reply! Yes, watching the assignment solution video i just realized how can be helpful :)
So, vector V's point of origin is P, and using the coordinate space of vectors x,y,z?
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?
transform.position only uses a Vector3, the w component is only used when you're using matrices directly, like transform.localToWorldMatrix
@@acegikmo Thanks for clarifying me! ♥️
Do the contents of a rotation matrix change depending on if Y is up instead of Z?
somehow unity using left hand rule with Y is up . speaking of transform rotation matrix itself, orientation will depend on where each basis vector land so yes it depend on which current basis vector goes
Hi @Acegikmo,
I have a problem at 2:33 (ua-cam.com/video/gVgN5SU6BrA/v-deo.html) because when I draw the normal it is wrong. I fixed it changing this line of code:
Gizmos.DrawLine(raycastHit.point, raycastHit.normal); =>
Gizmos.DrawLine(raycastHit.point, raycastHit.point + raycastHit.normal);
Maybe I miss any setting?
Thanks and best!
You are doing a fantastic job!
Gizmos.DrawLine's second parameter works in world space, so when you put normal's vector in there, it will project this vector from world space, not from hit space
It also would work if you used Gizmos.DrawRay, because it's second parameter project needed vector from first parameter position
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.
blud i fell asleep w my pc on and this came on
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.
lmao, what are you talking about
lmao, what are you talking about
@@usercontent2112 Woosh, over your head. 😂
💝💝💝💝
❤
wowo
Lol, people paying 40$ for broken games, while you hiding so satisfying thing on your hard drive. Shame! Push it immediately!
3:02 3:02 3:02
uyuhuhuhu
Banana
I... am so confused. I thought for sure you had made a mistake using column vectors in your 4x4 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...
I could tell that you were a man from your thumbnail icon, and did not even need to hear your masculine voice.
It's not too late to make the return journey.