How to get Mouse Position in 3D and 2D! (Unity Tutorial)

preview_player
Показать описание
👍 Learn to make awesome games step-by-step from start to finish.

💬 One of the comments I get a lot is people asking why the code shown in the video isn't working, and usually the reason is because in the video I showcase some system working in 2D and they're trying to get it to work in 3D.
It's pretty simple to get the mouse position in 3D but it is a completely different method compared to 2D.
So here let's see how both methods work and why they need to be different.

🌍 Get Code Monkey on Steam!
👍 Interactive Tutorials, Complete Games and More!

If you have any questions post them in the comments and I'll do my best to answer them.

See you next time!

#unitytutorial #unity3d #unity2d #unity​ #gamedev​ #indiegame​ #gamedevelopment #madewithunity​ #indiedev​

--------------------------------------------------------------------

Hello and Welcome!
I'm your Code Monkey and here you will learn everything about Game Development in Unity using C#.

I've been developing games for several years with 8 published games on Steam and now I'm sharing my knowledge to help you on your own game development journey.

I do Unity Tutorials on just about every topic, Unity Tutorials for Beginners and Unity Tutorials for Advanced users.

--------------------------------------------------------------------
- Other great Unity channels:
--------------------------------------------------------------------

Рекомендации по теме
Комментарии
Автор

💬 One of the common problems people have is using the 2D method in a 3D game, hopefully this video will clear up any confusion!
🌐 Have you found the videos Helpful and Valuable?

CodeMonkeyUnity
Автор

"shoot a laser from where the mouse is" excellent metaphor for the Raycast.

cpu_UP
Автор

I really like these short videos because if I don't know something I don't have to watch 20 mins of things i won't even use I get exactly what I need

leventebalog
Автор

Brillliant tutorial where everything's explained in a clear and precise way, thank you very much!

rambertoeco
Автор

Thanks for the video.Finally you explain actual code with logic rather than show half of code and other parts just "check my utilities" things.This is much better way than that i think.

unknownmaterial
Автор

THANK YOU! This helped me wrap my head around 2D > 3D / 3D > 2D conversion so much better. I can't believe I missed this when it dropped. Keep up the incredible work my guy. <3

stephenperry
Автор

Code Monkey is a good YouTuber, good coder, and pro-unity user, and his ad is all over the internet. he deserves more subscribers

shaladddin
Автор

best video explaining this, finally someone who understands what people go through who dont grasp the logic behind it.

TwiejkVR
Автор

Would be cool a version of this video with the Input System. Nice tutorial as always tho!

revengerwizard
Автор

If you always have the same "level field" then you dont really need collider and raycasting, with axis locking you can do some math to move 3D cursor around with the same result. Things get really wild fast if camera dynamic tho.

KeinZantezuken
Автор

Thank you, i can't believe how it is simple ! I took me 5h before to giveup and im glad i did to see this video !

omar-
Автор

Thanks. I implemented this method into my unity project and it worked exactly as I needed it to. Very helpful :)

omarmaaouane
Автор

thanks, i searched everywhere on the internet and this was the only video of the thing i wanted to do, also if anyone didn't have it work for the 3D you might have forgot to set the camera from the inspector like i did

craftlofer
Автор

This took me so long to figure out like 5 months ago. Glad you made this video.

nichegames
Автор

Thanks a lot saved me with a problem in grid system with 3D

ramunator
Автор

hi, this is your first tutorial i figured out, thanks.

dkordy
Автор

Just love your videos... if I encounter some problem = you provide the perfect solution, programming technique and explanation. Thank you!!

ElSonk
Автор

I was searching so a long time until I found this. Thank you man!

julianiano
Автор

Useful video ! We are waiting for more courses !

arcday
Автор

Code Monkey revived me this time or I have been dead to this point!!!
Wonderful video CodeMonkey!!!!
Thanks a ❤❤

mch_
join shbcf.ru