Unity 3D Mouse Input Rotation (In 2 Minutes!!)

preview_player
Показать описание
Mouse control is one of the easiest ways to control looking around in a game. It also turns out to be very straight forward code. Learn the basics of Mouse Input in Unity over the next 2 minutes!

If you enjoyed this video, I have a small 1$ Member perk available for anyone who would like to help us save up for Facial Motion Capture :)
(Just click the "Join" Button next to "Like"!)

Free Rigged Blender Male & Female Base Model:
Blender RIGGING & ANIMATION SERIES:

T-SHIRT LINKS HERE:

If you're a gamer, please check out my new game on steam! It took over 3 years to create and has thousands of hours and heart put into it :)

As always, thank you so much for watching, please have a fantastic day, and see you around!

- Royal Skies -
-------------------------------
I make no claim over the following footage as it belongs to their corresponding content creators and can be found below:

Copyright Disclaimer: Under Section 107 of the Copyright Act 1976, allowance is made for "fair use" for purposes such as criticism, comment, news reporting, teaching, scholarship, and research. Fair use is a use permitted by copyright statute that might otherwise be infringing. Non-profit, educational or personal use tips the balance in favor of fair use.
Рекомендации по теме
Комментарии
Автор

Here's the code in case you needed it! Hope it helps :)
{
public Vector2 turn;
public float sensitivity = .5f;
public Vector3 deltaMove;
public float speed = 1;
void Start()
{
Cursor.lockState = CursorLockMode.Locked;
}
void Update()
{
turn.x += Input.GetAxis("Mouse X") * sensitivity;
turn.y += Input.GetAxis("Mouse Y") * sensitivity;
transform.localRotation = Quaternion.Euler(-turn.y, turn.x, 0);
}
}

TheRoyalSkies
Автор

Great tutorial works even on Unity 5! Also you can add the lock for the y rotation so that it doesn't go further than 90 or -90, and to whoever needs that I did my own version (it's not that good I just started c#):

if (turn.y > 90)
{
turn.y = 90;
}
if (turn.y < -90)
{
turn.y = -90;
}

joji
Автор

bump for the yt algorithm. We need more tutorials like this in the community.

ktmochiii
Автор

I just ran into your videos the other day, and you probably make the best unity tutorials out there. You don't skip over important stuff, but you also do not go obnoxiously slow in the assumption that this is the first time your viewers have seen code. Keep it up ❤

redfang
Автор

as always, great and straight to the point video, just how we like them

RisuNiku
Автор

Euler == oiler/oyler, not yuler.
If I didn't bring it up, someone else would/will. No harm meant.

hansbrackhaus
Автор

by far the greatest tutorial on the internet.

wolfyyy
Автор

this is the best 3d tutorial
i have used

Hamdaishere
Автор

Simply incredible tutorial, its great that its straight to the point good job!

E_Hooligan
Автор

First time seeing one of your videos, that was such a fast and friendly tutorial, fixed my issues pretty quick. Hope to see some more! Really good content man !

BluzStudios
Автор

thank you so much I literallly watched so many youtube videos with so much information that didn't work thanks for finally making my script work

diazmichael
Автор

short, well explained and works
thats how i love tutorials

KematianGaming
Автор

Your tutorials are amazing, i just subscribe this channel.

playman
Автор

Thanks so much man I love when people leave code becouse it makes it easier for me to read it learn ext and use it even if I so choose

Hope the code still works!

-touya_todoroki
Автор

best video! staraight to the point and no time wasting.

incrediblecreativity
Автор

Thank you so much, this means alot to me.
I just finally found a tutorial for this, and this saved me alot of time. thank you so much.

puffip
Автор

Awesome video. Short and simple! Thank you

realkliment
Автор

Well you certainly know your audience. Subbed.

danm
Автор

Thank you very much sir! That was much apreciated!

jjpendragon
Автор

Love your vids, thank you very much for this concise and super clear tutorial.

raiden