Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

unity 2d looka tt mouse

void Update() {
     Vector3 dir = Input.mousePosition - Camera.main.WorldToScreenPoint(transform.position);
     float angle = Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg;
     transform.rotation = Quaternion.AngleAxis(angle, Vector3.forward);
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# get bits from float 
Csharp :: c# two different random numbers 
Csharp :: c# read next int Like Java 
Csharp :: c#: how to request for admin priviledge 
Csharp :: get item from icollection 
Csharp :: how to parse a string to an integer c# 
Csharp :: get rigidbody component unity 
Csharp :: cinemachine namespace not working 
Csharp :: unity gameobject to mouse 
Csharp :: if cluse in class in vue 
Csharp :: unity dontdestroyonload 
Csharp :: c# datetime now timestamp 
Csharp :: how to reference function in unity 
Csharp :: c# class to byte array 
Csharp :: c# return list 
Csharp :: c sharp array to list 
Csharp :: group by linq multiple columns c# 
Csharp :: remove first character in a string c# 
Csharp :: bootstrap modal popup 
Csharp :: c# how do you check if a string contains only digits 
Csharp :: instantiate iqueryable c# 
Csharp :: how to make a enum list in c# 
Csharp :: if char is upper csharp 
Csharp :: get input c# 
Csharp :: c# socket listen on port 
Csharp :: c# datagridview column size 
Csharp :: how to change a string variables value c# 
Csharp :: c# create array 
Csharp :: how to make a mouse down condition in C# 
Csharp :: how to read values from appsettings.json in c# 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =