Unity Mouse Position to World Space (Raycast) - Part 5 (Sinhala)
Автор: EraganX
Загружено: 2025-11-17
Просмотров: 5
3D Top-Down game එකකදී Mouse එක තියෙන තැන 3D ලෝකයේ (World Space) coordinate එකක් විදියට ගන්නේ කොහොමද?
අද video එකෙන් අපි ඒක කරන හැටි ඉගෙන ගමු.
අපි Camera එකේ ඉඳන් Mouse එකේ position එක හරහා Raycast එකක් යොමු කරනවා (Camera.ScreenPointToRay). ඒ Ray එක අපේ "Ground" Layer එකේ වැදුනම, ඒ වැදුන තැන 3D coordinate එක (hit.point) අපි C# script එකකින් අරගන්නවා.
ඊට පස්සේ, අපි හදාගන්න "Mouse Target" object එක ඒ 3D coordinate එකට නිතරම move වෙන විදියට හදමු. ඊළඟ video එකේදී (Turret Rotation) අපිට Aim කරන්න ඕනේ මේ Target එක දිහාටයි.
How do we get the mouse position as a coordinate in the 3D world (World Space) in a 3D Top-Down game?
In today's video, we'll learn how to do it.
We'll cast a raycast from the camera to the mouse position (Camera.ScreenPointToRay). When that ray hits our "Ground" layer, we'll get the 3D coordinate (hit.point) of the hit point in a C# script.
Then, we'll make the "Mouse Target" object we're creating move to that 3D coordinate. In the next video (Turret Rotation), we'll aim at this Target.
Simple Tank Controller Playlist:
• Unity Top-Down Tank Game Tutorial (Sinhala)
New Input System Playlist:
• Unity New Input System (Complete Sinhala G...
#UnitySinhala #GameDevSinhala #UnityTutorial #NewInputSystem #Unity3DSinhala #HowToMakeAGame #UnityTankGame
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: