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 :: c# change language version to 9.0 
Csharp :: c# datagridview select row right click 
Csharp :: get array from column datatable c# 
Csharp :: what is reflection in programming 
Csharp :: IHttpContextAccessor 
Csharp :: array object to datatable c# 
Csharp :: c# quit button script 
Csharp :: methods c# 
Csharp :: how to change dictionary value in c# 
Csharp :: while c# 
Csharp :: c# convert long to int 
Csharp :: how to close a form c# 
Csharp :: access object property C# 
Csharp :: how to create a variable in c# 
Csharp :: c# loops 
Csharp :: c# loop through dictionary 
Csharp :: What is the yield keyword used for in C#? 
Csharp :: data annotations in asp.net core 
Csharp :: how to iterate between hour range in c# 
Csharp :: unity c# cos inverse 
Csharp :: unity gameobject find inactive 
Csharp :: string substring c# before 
Csharp :: c# make file not read only 
Csharp :: visual studio c# mark class deprecated 
Csharp :: convert object to iqueryable in c# 
Csharp :: c# list find index 
Csharp :: longest substring without repeating characters 
Csharp :: cast from object to generic type c# 
Csharp :: password regex asp.net 
Csharp :: get key in dictionary c# 
ADD CONTENT
Topic
Content
Source link
Name
1+3 =