Spaces & Cross Product • Math for Game Devs [Part 2]

preview_player
Показать описание
Part two! let's talk about space

If you are enjoying this series, please consider supporting me on Patreon!

00:00:00 - Quick recap
00:01:01 - Dot product recap
00:06:51 - Asgmt. 1 solution (Radial trigger)
00:18:16 - Asgmt. 2 solution (Look-at trigger)
00:35:07 - Questions
00:42:24 - Spaces
00:53:26 - Asgmt. 3 solution (Space transformation)
01:18:43 - World to local
01:34:14 - Matrices
02:15:20 - Cross product

Assignments:
Asgmt. 4 (Bouncing laser)
Asgmt. 5 (Mesh surface area)
Asgmt. 6 (The turret)

✫ Video Production by Higher Vision:
Рекомендации по теме
Комментарии
Автор

I fell asleep watching product review videos and woke up to this playing

MrGhoulie
Автор

I've learned more in two days watching these videos than 6 months taking math classes

movgto
Автор

For those having trouble undeerstanding how the "orientation" and "scale"(the 3x3 part) frorm the matrix change our vector I recommend the first3 videos from "three blue one brown" channel's Essence of linear algebra"(if youre very lazy just watch the 3rd one, but I really recommend all of them) where he has a really nice visualization for this where any vector on the plane is defined as being made up of basis vectors(normal x, y, z vector aka our transform.right/up/forward - except they get normalized in unity) and so if you change basis vectors - you "warp" all defined vectors(space itself!).
This is actually where doing exercise 3 helps a bit as well, as its a good example of this.

The TL;DR version of it is: every vector can be defined as made up of scaled up basis vectors, so for example: a vector (2;3) is actually 2 * transform.right(gives us (2;0) normally) + 3 * transform.up ( gives us (0;3) normally) and if you change the basis vectors to be something else you "warp" all vecots with it.Very hard to explain in words, the animation in that video makes this 100x easier to understand.
Edit: do beware that I think he orientates the basis vector definitions into a column as opposed to the rows we see here, which can confuse people(like me).
Edit2: Nevermind, it was changed in this video as well.(I still find it harder to understand with basis vectors being columns for some reason, cant seem to multiply in my head)

naknuknik
Автор

I think I've finally had an "aha!" moment around transformations between coordinate spaces... The key that I was missing was in visualising the basis vectors of each coordinate space as having the same origin, then the transform for "each individual axis" is nothing more than a scaling factor!! Particularly so, since they're unit length.

I had trouble previously understanding exactly why we could multiply a point by the basis vectors of the transform, and for that to somehow manifest as a rotation. (It's wierd, I've learned so much beyond this fundamental principle and only just now "getting" it).

TimRex.
Автор

This is very informational. Specially the 3D stuff around cross products and how we use them in the games. Thank you Freya

usoppgod
Автор

You are a legend I never understood this at uni, so i just moved on and used things, did things but didnt understand it enough to do anything without googling it and seeing someone elses solution, this just made everything super easy in that i can finally work things out myself saving some time!

Chris_t
Автор

I have to watch these videos with headphones on now because Thor convinced my cat that there's a poor neglected cat friend trapped in my bookshelf speakers, and she keeps trying to bust him out of there.

LiveWire
Автор

1:46:56 You're wrong about the forth row of 4x4 transformation matrix as needed for "matrix multiplication to work". You may multiply 3x4 matrix by 4x1 [augmented] vectors without a problem, getting correct 3x1 vectors as result. The reason to have the fourth row is to map points in 3D space to vectors in projective 4D space, so every point on a vector in 4D space corresponds to the same point in 3D space. So for linear transformations you need 3x4 matrix, for projection transformation you need 4x4 matrix.

barabanus
Автор

Math with disgruntled cat noises in the background is best math! Thank you so much for doing this, it is so super helpful!!

fuzzyherbivore
Автор

really nice videos for people that want an introduction to math in game dev, very cool seeing someone actually explain the math using geometry aswell instead of just numerical representations, altou;
3:34 there is a way to compute the "projection vector" of "a onto b", namelly; "vector v", no nesesity for unit vectors with this projection formula:
(b.a / b.b) . b = v
That formula will give u the projection vector "a onto b" (vector v), where vector "v" is in the direction of vector "b", and the lenght of "v" is independent of the lenght of "b", for example:
if b is scaled by a factor of 3, then the formula would look like this;
(3b . a / 3b . 3b) . 3b = v
if we factor the 3´s we get:
[3 * 3 * (b . a) / 3 * 3*(b . b)] . b
so, as u can see, all the 3´s asosiated to the b´s get canceled and we get the previous formula (b.a / b.b) . b = v
"v" will be dependent on the lenght of "a" sinse thats the vector we are projecting onto b.
This formula is used when u dont know the angle teta.

gutzimmumdo
Автор

After being confused and banging my head for 4 hours, finally got what Freya did with the space transformations exercise. Thank you.

crossface
Автор

Long Story short for Dot Product.

1. You need at least 1 normalized Vector to project into another. A common use is to project a not normalized one into a normal surface.

2. You ends up with two possibilities:
Not-Normalized x Normalized & Normalized by Normalized.

Normalized x Normalized: Exclude the length of the vector and end up with only a direction:
1 (same direction),
0 ( perpendicular ),
-1 (Opposite).

Not-Normalized x Normalized: dot returns a length in a scalar.
This scalar represents how far the direction projected along the distance axis

== values -> Same direction
- values -> Towards opposite direction
+ values -> Towards Same Direction
Scalar length : How far it projected

maiksonstrife
Автор

"So we don't have to press the play button.. cause that's gross!" :D - love it.

deecsaunders
Автор

I found these classes a couple of days ago, awesome stuff! I really like how you present practical use cases for the things you are teaching.

mauriciopartnoy
Автор

Freya, you're a very good teacher. That's rare.

SergeyBerengard
Автор

when u started explaining world to local it was so confusing I suddenly forgot all the vector stuff from last video. 🤣

bxbvxbv
Автор

Correction: at 1:42:00 Freya says that the x basis is the first row. That's not true. It's the first column. Unity uses column major matrices so that's maybe why it might be easy to make the mistake.

jesperpersson
Автор

You use the 4th row and column of the matrix because translation isn't actually a linear equation, so you do a shear in 4 dimensions instead.

Ed: I just deleted part of this that was ridiculously wrong. My apologies to anyone who read it.

ernststravoblofeld
Автор

Your teaching is amazing, love from India

mdaszadqureshi
Автор

2:04:08 so what u are doin is basically a change of basis?

gutzimmumdo
visit shbcf.ru