A
A
Afafks1231321321652020-03-18 20:17:33
Game development
Afafks123132132165, 2020-03-18 20:17:33

How to make a turn with the mouse?

I'm starting to work with unity how to make a turn after the mouse. If it's not difficult, could you attach the code. Thanks for the answers.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Alkhimenko, 2020-03-22
@Afafks123132132165

float speed = 5f;
void Update()
{
transform.Rotate( new Vector3(Input.GetAxis("Mouse Y"), Input.GetAxis("Mouse X"), 0) * Time.deltaTime * speed);
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question