Thanks for watching all! We'd love for you to help our channel grow by sharing it with your groups!
@smirelesz Жыл бұрын
Thank you for this tutorial! You explained everything in a normal conversation speed, giving us time to digest what you are saying and doing cursor movements that helps in how you are making your points. /bow
@alexfish77925 жыл бұрын
Great tutorial. But... offsetting the angle by -90 deg is not because of Unity. 0 deg starts at 0 on the x-axis and would prove the same for the arrow if the texture started out pointing on the x-axis. The offset is because your arrow's texture starts out pointing on the y-axis and this is where the extra 90 degrees comes from. Just look carefully where the arrow's red x-axis points when you think something is wrong. 12:28
@gamedevhq5 жыл бұрын
Re-watching you're right. This could be resolved through the orientation of the object as well. Thanks for the explanation!!
@alexfish77925 жыл бұрын
@@gamedevhq Happy to help! I'm just sorry my comment was as long as a book!
@harrysanders8184 жыл бұрын
@@alexfish7792 you call that a book? :D Thanks for clarifying!
@azyjmexcuseokstop9243 жыл бұрын
@@alexfish7792 there exists longer comments
@whitedeath505710 ай бұрын
thank you for this comment lmao because i was thinking the same thing
@supertenchoo42712 жыл бұрын
Best tutorial ever , I would love to see a tutorial of making field view
@anjobihis20524 жыл бұрын
Best tutorial for this aspect. We want more!!
@clashingdrash17722 жыл бұрын
Just because of your tuts I start to enjoy coding
@rkay.gaming3 жыл бұрын
Oh my God! Thanks a lot bro. Finally a straight forward video explaining angles.
@polferdman92225 жыл бұрын
WOW! I was looking for a tutorial like this for months!!!! truly helpful, i will chek your chanell for more content, TY
@user-pf3zb7lv9b4 жыл бұрын
1 minute and 40 seconds in i already understood what's going to happen, thanks so much!
@nexxogen6 ай бұрын
The reason why the arrow wasn't initially pointed towards the target is not because of clockwise vs counterclockwise implementation at all (in fact counterclockwise is indeed the positive rotation direction in Unity too). It was simply because the arrow sprite was pointing upwards along the Y axis. Your rotation calculation ends up pointing the X axis of the object towards the target while you wanted to point its Y axis towards the target, and that is why you had to subtract 90 from the calculated angle. If the arrow sprite was aligned with the X axis, then you wouldn't have to do anything to the original calculation.
@RenCode5 жыл бұрын
GREAT VID BRO !
@gamedevhq5 жыл бұрын
Thanks bro!
@zentergames16225 жыл бұрын
Useful tutorial
@gamedevhq5 жыл бұрын
Thanks for watching!
@reparosempra8901 Жыл бұрын
Finally someone who pronounces Euler correctly.
@Chubzdoomer Жыл бұрын
YOOLER
@nanifiqueyt4 жыл бұрын
In the new Vector3 of Camera.main.ScreenToWorldPoint I would most likely use 'Camera.main.transform.position.z * 0' to make sure that it always returns to 0 on Z axis no matter what the number is. Just to be safe in case someone changed the Z position of the camera.
@fastsolution4 жыл бұрын
Instead of subtracting just invert the values instead of tan(y/x) we can say Tan(x/y)
@Kusanagi642 жыл бұрын
That is indeed a.... fast solution!
@AHEK89 ай бұрын
Are you from brackeys channel ? 😅
@annafyazad42585 жыл бұрын
Best teacher 😍
@HamzaIndieUnity2 жыл бұрын
Thank you so much, well explained ♥
@NiclasGleesborg05 жыл бұрын
Very useful for those unfamiliar :)
@МихаилМедведев3 жыл бұрын
Amazing work maaan. Thank you so much!!!
@elliets37473 жыл бұрын
ILL GIVE YOU A KISS BRO, THANK YOU SO MUCH
@marcosssocram3 жыл бұрын
Thank You, your videos are gold :D
@CodingWithUnity5 жыл бұрын
great video as always :)
@manjunathj92025 жыл бұрын
extremely helpful, thanks!
@saadbutt21865 жыл бұрын
Thank u sir it helps alot to understand vectors , direction and rotation . can u make a video on "Rotations" in unity difference between tranform.EulerAngles and Quterniom.Euler and when should we use either of these....
@adamprokop4 жыл бұрын
Very useful, thank you.
@brunomoreno36662 жыл бұрын
excellent video! thank you very much!
@zentergames16225 жыл бұрын
Very useful tutorial👍
@yugioh-furkan-45084 жыл бұрын
Great super useful tutorial thank you
@NoNameApprot5 жыл бұрын
Well done sir. Always good content ;) thank you.
@gamedevhq5 жыл бұрын
Thanks for watching!
@minhtri75252 жыл бұрын
Amazing 🤓💙
@hype._.3 жыл бұрын
Thank you.
@thesejo.66913 жыл бұрын
More please
@YellowFireIpad2 жыл бұрын
Hey GameDev! I was wondering if you could make a tutorial on turning joystick input into rotation
@noobcoder32033 жыл бұрын
Can you make video on trajectory path prediction
@zogoloov43135 жыл бұрын
thanks this very amazing
@pastuh4 жыл бұрын
how i can can create multiple raycasts from object including edges, based on object rotation? imagine if coin on edge or flat on ground..
@sekhardeka4984 жыл бұрын
Good tutorial bruh
@Konradulations4 жыл бұрын
Hi, this 16:37 is basically exactely what i have sofar and need but i need the arrow/sprite facing towards the ever changing mouse position while its being dragged. aka i need the sprite to rotate in direction of drag (without using velocity) any help would be appreciated thanks
@Konradulations4 жыл бұрын
i tried using transform.Translate(direction, Space.Self); but this makes it rotate 360degrees continousy
@alideveloper69454 жыл бұрын
can't we use of Transform.LookAt(target) ?
@manishakawlekar84984 жыл бұрын
Namaste, Transform.LookAt works only for 3d in 2d the Z messes things
@deimosjuf5 жыл бұрын
Best regards How i print in a canvas the angle of rotation of a game object?
@nikhiljayanthi47243 жыл бұрын
for some reason when i entered the code using the eulerAngles i get an error CS1519 saying that the equal sign is an invalid token in class. how to i fix this
@lokeshgoyal1208 Жыл бұрын
For Fetching the angle, if you instead of write Mathf.Atan(y/x) to Mathf.Atan(x/y), than it gives the same result. any idea why
@ЕвгенДи5 жыл бұрын
Awesome:)
@gamedevhq5 жыл бұрын
Thanks for watching!
@vannda27435 жыл бұрын
explain trajectory prediction please
@gamedevhq5 жыл бұрын
Read my mind! ;) Coming out soon!
@vannda27435 жыл бұрын
Wow yeah... Thank you very much :)@@gamedevhq
@ssmasrour5 жыл бұрын
Videos such this and calculating direction is not in the "coding math" playlist and seems these videos is not collected in a relevant playlist
@7studiodev5 жыл бұрын
Awesome Tutorial
@gamedevhq5 жыл бұрын
Thanks for watching! We'll see if we can get more demand from it!
@Skillet3675 жыл бұрын
Amazing tutorial bro, can you please send a link to your arrow sprite image, would be much appreciated!
@pattech39605 жыл бұрын
Just install one on the internet as a PNG
@Skillet3675 жыл бұрын
@@pattech3960, nevermind I already drove one with paint 3d, images that I got from the internet were not transparent in google, so I used paint 3d and it worked!
@pattech39605 жыл бұрын
@@Skillet367 Ah okay :)
@CodeBlues-TimeisGold5 жыл бұрын
좋은 강좌 감사합니다. ^^
@songwonchoi16795 жыл бұрын
the tiny keyboard sounds are very pleasing mmm
@992darus2 жыл бұрын
Can someone explain to me how this is work: Tan -1 (1.25) = 51.34 ? Where did you get this number: 51.34 because I don't understand this ;(
@artlab57245 жыл бұрын
It is only works for 2d? In 3d it isn't works
@monkeyrobotsinc.98754 жыл бұрын
john with gemdevichew?
@rashidfarhan62235 жыл бұрын
why do we get 128 instead of 51 ish?
@rathodketan55512 жыл бұрын
Could you please expaint this (Tan -1(1.25)=51.34)
@hydroweapon2 жыл бұрын
I don't understand - the mouse cursor one doesn't work? ***UPDATE*** I worked it out - it just doesn't work with UI elements - you need to do something extra for that
@JonTopping2 жыл бұрын
I have no idea why, but this is totally not working for me. The goal is to have the enemy always face the player. The enemy is using navmesh to walk towards the player (and in that case it automatically rotates towards what it's walking towards). I've tried both the methods you gave, and for some the enemy will warp to facing the left of player (towards the west), and then slowly rotate to face the player (probably by the navmesh?) and then when it's facing the player the rotation will warp back to west (so the enemy is facing to the left of the player). It acts the exact same, regardless of which method I try. I tried removing the -90, changed it to +90, and tried +180, and yet it still does the EXACT same thing, which makes zero sense to me. I've also tried changing the destination.x/y to using Z, since I'm doing this in 3D. However, the results are again the EXACT same, which just boggles my mind. The angle value remains the same as well. You would think adding 90/180 degrees, and changing the axis, would totally change the outcome, but it's consistently doing the same thing. There were a lot of conversions happening in your video, which were obviously needed, but it's probably just something lost in translation that I don't get.
@pirateskeleton7828 Жыл бұрын
Hello. Did you ever solve your issue? The most helpful thing I ever did to help keep rotation and direction from getting janky, is to restrict the angles from any calculation to be between -180 and 180. This really helps when telling your object to turn right or left. I can provide more explanation if needed.
@ShakerFS3 жыл бұрын
I love you
@FaizKhan-pi7ds2 жыл бұрын
Super Cool 🥰🥰🥰🥰🥰🥰🥰🥰🥰
@zentergames16225 жыл бұрын
👏👏
@monkeyrobotsinc.98754 жыл бұрын
axis and access are two different words.
@daboxguy38483 жыл бұрын
This guy prefers kebabs - burgers make him wein! Nice Lecture. Good to see some proper math for once.
@MassimoRough5 жыл бұрын
Solid math application here. But.The rotation is done correctly only in second case, with eulerAngles. The slerp is not used as it's meant to be, and it's a shame that even Unity points toward wrong using in their documentation. Lerping methods return the value between two values specified as a parameters, at some point of progress which is 3rd parameter - t [0, 1]. It shows how progressing the return value will get from start to end values. In your implementation you pass 50*Time.deltaTime, which is ~1, so you set the rotation to end value immediately and gives "same" result. Lerping would be applicable if there is a need in changing rotation over time, and as this time would range from 0(start time) to 1(end time) , it will map returning value accordingly from its startValue to endValue. Usually done with coroutines, and not as it is shown in documentation.
@alexfish77925 жыл бұрын
100% agree about Lerp/Slerp! Check this out -> chicounity3d.wordpress.com/2014/05/23/how-to-lerp-like-a-pro/
@rwoodvet4 жыл бұрын
How would I calculate the angle if I could only calculate the distance between to objects on the y axis. For example in 2D space, if object1 is falling in a linear direction (no gravity) towards a platform, how would you calculate where object1 will collide with said platform before collision? Btw, I never took this level of math in school, but I understand it the way you teach it, so thank you!
@gamedevhq4 жыл бұрын
not fully following the question. I'd suggest posting your question in our discord channel. gamedevhq.com/discord
@beaverjoe91715 жыл бұрын
likes
@TheEthikos2 жыл бұрын
Wow I've never heard someone mispronounce axis before.