Are you enjoying the new Coding Math series? Do you want more math related videos? Do you want me to dive deeper into the actual mathematics? Or keep it high level? Also! What are your thoughts on a Sunday release schedule at 4pm eastern time compared to Mondays at 9am eastern time?
Quick Q..well long one actually lol, Really struggling here: How do I detect which way the player is facing? i.e. I have a UI Icon that I need to move in a wind direction by 180 degrees depending on of the player is moving forward z or -z direction, tried this: if (Mathf.Abs(Vector3.Dot(Player.transform.forward, Vector3.forward)) == 1) { aligned = true; } { if (aligned) { WindArrowR.SetActive(false); WindArrowL.SetActive(true); } else { WindArrowL.SetActive(false); WindArrowR.SetActive(true); } } this is done when entering OntriggerEnter from facing in the -z direction then on coming back facing the z direction but it always just gives me the else scenario no matter how I change it also strangely enough, If I drag my player backwards using the z arrow gizmo on the player it works...then doesn't, is that an OnTriggerEnter flaw? tried in FixedUpdate but got similar results even worse. I even tried if(Player.transform.rotation.y > 180) and if(Player.transform.position.z > 0) things like these plus many more to no avail. My player gets pushed always with the wind in the x direction no matter which way I walk which is perfect, I use: _CharController.SimpleMove(WindZone.GetComponent().direction * WindZone.GetComponent().strength); works just fine every time you enter the wind area, but can not get that UI Icon to work properly, I even had just one UIArrow at first and had it rotate using Vector3.forward, 180 for left the o for facing right where it starts when its hidden and that gave me continuous 180 movements every time I entered the trigger zone as I thought I had it with that but nope then arrow just kept moving 180 every time. I wish there was more info on World space movement and forward and walking in -forward using if statements like if(player is facing in z direction) do this if(player is moving in -z direction) do that, but can not find nothing apart from the if(Mathf.Abs(vector3.Dot() I found online and have used Vector3.back but when I do that no icons highlight at all, all very bizarre, been at this nearly 3 weeks, breaking my stuck for record lol. Any Help on regards to direction facing and movement in the z direction and also the x direction for further wind zones would be fantastic, thanks and all the best, great vids.
I'm still new but I've seen a lot of talk about normalizing the magnitude and it always left me confused! I always wondered why you needed to normalize and this video explains it wonderfully!
love u man I was starting my own game and I wasnt concerned about how does it was working, the i got stuck on a problem with raycasts. Now I fixed the error because of your video man i cant express how much did you help me i am so grateful. huge like
Hey man, so I'm a beginner programmer in his first year of college. I have a had a lot of trouble understanding how the math works in Unity. This video made so many things make sense to me and opened up so many doors when it comes to programming. Thank you for making this amazing and informative video! I will be checking out your other videos on math in Unity and hopefully they help me understand more. Thank you again and keep up the great work! :D
Fantastic video, I try to learn in godot and couldn’t imagine how direction works. Ty so much I love videos about small but also important things You did a great job!
I've needed this my whole life thankyou. Your teaching skills are super impressive it must be helping elevate so many people. So happy to be working through your courses on Udemy.
I really enjoy this Math series coz it is better to understand what you do when you are wrintig code. And this course will help us in that way. I want it more and from beginner to high level. It will be so helpful. Thanks
the formula for pythagoras theorem is a^2 + b^2 = c^2. Destination - source gives us the length of one side that later we plug into pythagoras formula and root it. I don't see you doing that in this video. Then how does it work?
Just a quick question is the real formula of direction in timestamp(2:00) is f(x) = x^2 - 1, and Is this included with the "Pythagorean theorem" or is this different?
Amazing tutorial how we use that info to make a player move around the 3D space in relative with the real one. The idea is to use the mobile phone as a VR headset and take the mems data in order to move the player when we actually move around?
And you don't even need to use trigonometry in this scenario either! You can use vector math directly to calculate the vector needed to reach your destination, just subtract the current transform position (vector2) from the target position (vector2) and if you want to know the angle you simply use the Mathf.Atan2(vector.x, vector.y) function! But you do not need to, you can move the character using vector math as well!
I'm confused here. I used to think a vector3 was just three float values, but it looks like it's a lot more than that, considering you're getting a .magnitude from it? How then is it calculating a position minus another position? That would only affect the XYZ, right? So the XYZ of the vector3 because a new value, so how does it determine the magnitude in this sense?
A vector is a transformation from one point to another. We usually visualize it as an arrow. You calculate the length of that arrow form the pythagoran theorem if it's a 2D vector: c^2 = a^2 + b^2 Or maginitude^2 = x^2 + y^2 For a 3D vector it is: magnitude^2 = x^2 + y^2 + z^2 or magnitude = sqrt(x^2 + y^2 + z^2)
Ok one thing that's always confused me. I understand direction and normalized vectors but how do we find a facing direction of a player that's standing still? There is no destination to add to the calculation. I know there is something obvious I'm missing here. If someone can please clarify this I would be so happy because I need to know how to do this
GameDevHQ:pls can you explain transform.TransformDirection(); actually public Vector3 TransformDirection(Vector3 direction); can you explan me how that work?video for that pls and this video so helpfull!
"That's how learning works right?" Yes it is. Having fun is mandatory to learning, in contrast to school where learning means the least amount of fun possible. It's a shame how this bad make a bunch of "working drone" system works. It's crazy how many people would be accel in so many areas, with a little bit of more fun.
Are you enjoying the new Coding Math series? Do you want more math related videos? Do you want me to dive deeper into the actual mathematics? Or keep it high level? Also! What are your thoughts on a Sunday release schedule at 4pm eastern time compared to Mondays at 9am eastern time?
want more video like this
want more plz
Yes
Quick Q..well long one actually lol, Really struggling here: How do I detect which way the player is facing? i.e. I have a UI Icon that I need to move in a wind direction by 180 degrees depending on of the player is moving forward z or -z direction, tried this:
if (Mathf.Abs(Vector3.Dot(Player.transform.forward, Vector3.forward)) == 1) { aligned = true; }
{
if (aligned) { WindArrowR.SetActive(false); WindArrowL.SetActive(true); } else { WindArrowL.SetActive(false); WindArrowR.SetActive(true); }
}
this is done when entering OntriggerEnter from facing in the -z direction then on coming back facing the z direction but it always just gives me the else scenario no matter how I change it also strangely enough, If I drag my player backwards using the z arrow gizmo on the player it works...then doesn't, is that an OnTriggerEnter flaw? tried in FixedUpdate but got similar results even worse. I even tried if(Player.transform.rotation.y > 180) and if(Player.transform.position.z > 0) things like these plus many more to no avail. My player gets pushed always with the wind in the x direction no matter which way I walk which is perfect, I use: _CharController.SimpleMove(WindZone.GetComponent().direction * WindZone.GetComponent().strength); works just fine every time you enter the wind area, but can not get that UI Icon to work properly, I even had just one UIArrow at first and had it rotate using Vector3.forward, 180 for left the o for facing right where it starts when its hidden and that gave me continuous 180 movements every time I entered the trigger zone as I thought I had it with that but nope then arrow just kept moving 180 every time.
I wish there was more info on World space movement and forward and walking in -forward using if statements like if(player is facing in z direction) do this if(player is moving in -z direction) do that, but can not find nothing apart from the if(Mathf.Abs(vector3.Dot() I found online and have used Vector3.back but when I do that no icons highlight at all, all very bizarre, been at this nearly 3 weeks, breaking my stuck for record lol.
Any Help on regards to direction facing and movement in the z direction and also the x direction for further wind zones would be fantastic, thanks and all the best, great vids.
@@L1ghtOn3 check if the z direction is pos or neg, based on that do it.
Do more of this, really interested in incorporating math into Game Development!!!
Thanks, mate! More is coming :)
@@gamedevhq 5 years later ... tumbleweed
This is the best explanation of this I have seen. I knew this but, I am not disappointed on watching
Thanks a lot. Keep it coming please. Such a great series already.
Thanks Raina!
I'm still new but I've seen a lot of talk about normalizing the magnitude and it always left me confused! I always wondered why you needed to normalize and this video explains it wonderfully!
love u man I was starting my own game and I wasnt concerned about how does it was working, the i got stuck on a problem with raycasts. Now I fixed the error because of your video man i cant express how much did you help me i am so grateful. huge like
It seems you've only made two of these math tuts, keep making them man they're really helpful.
thanks SO much! not many people provide any information on making enemy ai these days, and you did. Thank you so much for this. Am subbing :))
This is the real gift to myself for the Christmas 2021
Really great guide. I have been using direction until now without knowing it mathematically.
Hey man, so I'm a beginner programmer in his first year of college. I have a had a lot of trouble understanding how the math works in Unity. This video made so many things make sense to me and opened up so many doors when it comes to programming. Thank you for making this amazing and informative video! I will be checking out your other videos on math in Unity and hopefully they help me understand more. Thank you again and keep up the great work! :D
Best source to understand applied vectors
This is mind blowing !!!
Your explanation is SO CLEAR and simple
I’m a subscriber now
Awesome... I got sin() in my recommendation today...and watched this video too.... Your way of explanation is very good ...make more about unity math
Please make more of these!! this is an area in Unity that isnt really covered enough by tutorials and this is excellent stuff
Fantastic video, I try to learn in godot and couldn’t imagine how direction works.
Ty so much I love videos about small but also important things
You did a great job!
The best tutorial I've ever watched for game dev your channel will rlly help me to improve :)
Bro your video is absolute mind-blowing. Thx for explanation
You are the best teacher i hv ever got.
These are great, very helpful. Would love to see a whole series on practical uses of different maths in gaming/non-gaming apps.
Taking notes on this video. Very clearly explained. Thanks
Thanks for watching mate!
Amazing! Thank you! Also nice outro.
continue this series it help us who are suck in math...nice explanation with visual graph
I've needed this my whole life thankyou. Your teaching skills are super impressive it must be helping elevate so many people. So happy to be working through your courses on Udemy.
Thanks a lot man, I've taken a few classes now and read a bunch but your video still helped me better understand Vector3's!
I really enjoy this Math series coz it is better to understand what you do when you are wrintig code. And this course will help us in that way. I want it more and from beginner to high level. It will be so helpful. Thanks
Awesome,I think its really underrated channel.
the formula for pythagoras theorem is a^2 + b^2 = c^2. Destination - source gives us the length of one side that later we plug into pythagoras formula and root it. I don't see you doing that in this video. Then how does it work?
well explained bro plz do more like this
This really helped me in the shortest amount of time. Thanks GameDevHQ!
this is the type of info what i need thx for this
this is so valuable. Good stuff!
Just a quick question is the real formula of direction in timestamp(2:00) is f(x) = x^2 - 1, and Is this included with the "Pythagorean theorem" or is this different?
Very usefully!!!!. Thanks a lot
Thank you soo much first time I really enjoy on doing program
Sorry I am late to the party, love the new series, I am sure I will learn a lot as I suck at Maths. Thank you, Jonathan.
Your thumbnail was really intimidating. Saw it many times but never clicked. But good vid after all.
The best explanation of this topic
Thanks for creating this.
Hi thank you for the tutorial. Can i also us this somehow for wayfinding. Like to create a navigation app? To calculate route?
You make love mathematics ohh , your amazing
2:02 that's all i need, thanks
Just got to say I love this Math tut keep them coming cuz too suck at math!!!
Thanks for watching!! New coding math video coming out next week!
Really enjoyed these, thanks.
More please!
Very useful video, thank you!
Same i only started liking math after finding a use for it
Amazing tutorial how we use that info to make a player move around the 3D space in relative with the real one.
The idea is to use the mobile phone as a VR headset and take the mems data in order to move the player when we actually move around?
Would be also nice if you would show what object did you use for the tutorial in the Unity, I found quad that looks similar but not like that.
Hey mate, just a 2D sprite :)
@@gamedevhq got ya, thanks for the answer! You should keep on doing such series!
@@Skillet367 Of course! Next video drops monday on calculating Angles! :)
i like it cuz of more details nice method of teaching
this is so awesome!!!!!!!!!!!!
Interesting can you show trajectory path i need it in its most simple form
very understandable thank u so very much, love ur channel
Thanks for watching!!
Can you make a video explaining math.abs and epsilon please
Stunning video! I was wondering, would it be possible if you guys would make a tutorial about Integrals and how they could be applied? Thanks. :)
And you don't even need to use trigonometry in this scenario either!
You can use vector math directly to calculate the vector needed to reach your destination, just subtract the current transform position (vector2) from the target position (vector2) and if you want to know the angle you simply use the Mathf.Atan2(vector.x, vector.y) function! But you do not need to, you can move the character using vector math as well!
(which you obviously did as I continued watching the video)
I want to know everything there is to know about all the necessary math to make cool enemy movement! xD
I'm confused here. I used to think a vector3 was just three float values, but it looks like it's a lot more than that, considering you're getting a .magnitude from it? How then is it calculating a position minus another position? That would only affect the XYZ, right? So the XYZ of the vector3 because a new value, so how does it determine the magnitude in this sense?
A vector is a transformation from one point to another.
We usually visualize it as an arrow.
You calculate the length of that arrow form the pythagoran theorem if it's a 2D vector: c^2 = a^2 + b^2
Or maginitude^2 = x^2 + y^2
For a 3D vector it is: magnitude^2 = x^2 + y^2 + z^2
or magnitude = sqrt(x^2 + y^2 + z^2)
best explaination
thanks sir!
More please
Thanks!
I absolutely love the video. It really helped for my code but the editing is a bit weird with all the images popping up. Otherwise I love the intro.
A bit late, but thx for the video. Very understandable.
Greetings from germany :)
Thank you Jon!!
Thanks for watching!
Wonderful...!
Ok one thing that's always confused me. I understand direction and normalized vectors but how do we find a facing direction of a player that's standing still? There is no destination to add to the calculation. I know there is something obvious I'm missing here. If someone can please clarify this I would be so happy because I need to know how to do this
You just add a variable to remember the direction last time the player object moved
will it work?
transform.Translate(_player.position * time.deltaTime);
Bro you are fucking awesome. You need to start a udemy class or something. I have yet to find anyone doing what you're doing.
ty
You
Are
Tottaly
AWSOME ❤❤❤❤😘😘😘😘
this is x and y ,what if there is also z ?
No this is both x, y and z. It's a Vector3 so there are three coordinates. You can also see he moves the object in the z direction at one point
1:44 I feel like one of the kids now...
Wish this was in 3d space
Oh so this is kind of how Vector3.Distance works
well fuck, just learned to make a smooth follow cam in a short ammount of time, AND i know why the hell it follows me.
ok, u know that there are pre-made functions? u just need to add parameters then boom output!
Einstein was excelent in Math =) (truly)
GameDevHQ:pls can you explain transform.TransformDirection();
actually public Vector3 TransformDirection(Vector3 direction);
can you explan me how that work?video for that pls and this video so helpfull!
this is just a conversion from localSpace to worlspace.
I don't know what others think but I find the background music distracting. It's fighting with your voice in my head.
"That's how learning works right?" Yes it is. Having fun is mandatory to learning, in contrast to school where learning means the least amount of fun possible. It's a shame how this bad make a bunch of "working drone" system works. It's crazy how many people would be accel in so many areas, with a little bit of more fun.
lol your outro
ha, you like it?
@@gamedevhq Yes thats cool
May be you don't know how much math is required for graphics programming and game engine development
i dont get this video its supposed to be a tutorial right so why not just get to the point instead of all of that intro about math
Please Remove that music.. It's not helpful, it's Constantly distracting from anything that requires any amount of thinking.