Menu
Newbedev LogoNEWBEDEV Python Javascript Linux Cheat sheet
Newbedev LogoNEWBEDEV
  • Python 1
  • Javascript
  • Linux
  • Cheat sheet
  • Contact

how to make something point the mouse in unity code example

Example: how to make an object point towards the mouse in unity

//Inside your update loop, add the following code:

//First, get the mouse position
Vector2 mousePosition = new Vector2 ( 
  Input.GetAxis("MouseX"), 
  Input.GetAxis("MouseY")
);
//Then, use unity's built-in lookAt function to do all the math for you:
transform.LookAt(mousePosition);

Tags:

Csharp Example

Related

aws js sdk download just lambda code example pandas add conditional column code example bootstrap search bar hf code example on application exit node code example how to check how many contents are in a list py3 code example locate postgres data directory code example add multiple things to array code example pdf page to word code example reverse engineering code example .net deserialize xml code example How does autoloading work? in php code example valores faltantes pandas code example

Recent Posts

Pandas how to find column contains a certain value Recommended way to install multiple Python versions on Ubuntu 20.04 Build super fast web scraper with Python x100 than BeautifulSoup How to convert a SQL query result to a Pandas DataFrame in Python How to write a Pandas DataFrame to a .csv file in Python
© 2021 newbedevPrivacy Policy