Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

rotation unity script 2d

transform.Rotate(Vector3(0, 0, 50));
//instead of :
transform.eulerAngles = new Vector3 (0, 0, 50);
//or like you said
transform.eulerAngles = Vector3.forward * 50;
Comment

2d rotation unity

// Rotation scripting with Euler angles correctly.
// Store the Euler angle in a class variable, and only use it to
// apply it as a Euler angle, but never rely on reading the Euler back.
        
float x;
void Update () 
    {
        x += Time.deltaTime * 10;
        transform.rotation = Quaternion.Euler(x,0,0);
    }
Comment

rotation unity script 2d

transform.eulerAngles = Vector3.forward * degrees;
// or
transform.rotation = Quaternion.Euler(Vector3.forward * degrees);
// or
transform.rotation = Quaternion.LookRotation(Vector3.forward, yAxisDirection);
// or
transform.LookAt(Vector3.forward, yAxisDirection);
// or
transform.right = xAxisDirection;
// or
transform.up = yAxisDirection;
Comment

PREVIOUS NEXT
Code Example
Csharp :: unity exception 
Csharp :: gameobject on click unity 
Csharp :: unity c# random number 
Csharp :: c# access session in class 
Csharp :: unity ui movement 
Csharp :: unity play sound effect 
Csharp :: how to start a webpage from a button c# 
Csharp :: string list to object array in c# 
Csharp :: remove adjacent duplicate characters 
Csharp :: unity random point in sphere 
Csharp :: c# main 
Csharp :: project mongodb c# 
Csharp :: c# OrderBy desc 
Csharp :: c# best tutorial 
Csharp :: c# list object sort alphabetically 
Csharp :: string to camel case c# 
Csharp :: Squares of a Sorted Array 
Csharp :: how to run a c# program 
Csharp :: instantiate a player in photon 
Csharp :: how to play multiple sound at once on c# windows form 
Csharp :: checking if character is a digit or not in c# 
Csharp :: c# get total milliseconds from datetime 
Csharp :: make command prompt hidden c# 
Csharp :: transform.position.x unity 
Csharp :: xamarin picker 
Csharp :: c# get list item in random order 
Csharp :: is number c# 
Csharp :: upload file using httpwebrequest c# 
Csharp :: c# list.foreach 
Csharp :: unity yield return 
ADD CONTENT
Topic
Content
Source link
Name
9+2 =