Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

smooth rotation unity

Vector3 targetRotation = path[i].transform.position - transform.position;
transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(targetRotation), 4f * Time.deltaTime);
//LookRotation points the positive 'Z' side of an object in a specified direction
//FromToRotation creates a rotation that from one direction to another direction
Comment

unity smooth rotation 2d

 float targetAngle = 90;
 float turnSpeed = 5;
 transform.rotation = Quaternion.Slerp (transform.rotation, Quaternion.Euler (0, 0, targetAngle), turnSpeed * Time.deltaTime);
Comment

smooth rotation unity


float turnTime = 50f;
Quaternion target = Quaternion.Euler(mainCamera.eulerAngles.x, mainCamera.eulerAngles.y, 0f);
transform.rotation = Quaternion.RotateTowards(transform.rotation, target, turnTime * Time.deltaTime);

Comment

PREVIOUS NEXT
Code Example
Csharp :: c# convert dictionary to anonymous object 
Csharp :: c# create new thread 
Csharp :: c# copy to clipboard 
Csharp :: bash if null or empty 
Csharp :: c# output double with precision 
Csharp :: get text between two strings c# 
Csharp :: c# convert string to double 
Csharp :: cannot convert string to long c# 
Csharp :: easily start admin process from service c# 
Csharp :: how to convert angle to vector in c# 
Csharp :: set text in center wpf 
Csharp :: instantiate an object at a certain position unity 
Csharp :: unity print 
Csharp :: random number generator c# 
Csharp :: csharp get integer part of number 
Csharp :: unity get project file directory 
Csharp :: c# map number range 
Csharp :: unity how to wait for seconds without coroutine 
Csharp :: pass parameter to thread c# 
Csharp :: wpf fixed size window 
Csharp :: Set value into lookup field in console app using dynamic CRM 365 
Csharp :: axwmp balance c# 
Csharp :: shutdown system c# 
Csharp :: c# unity destroy first child object 
Csharp :: c# open file in default program 
Csharp :: c# winforms textbox readonly 
Csharp :: csharp datetime string format 
Csharp :: iterate through xpdictionary devexpress 
Csharp :: canty obituary schenectady ny 
Csharp :: wpf yes no message box exit 
ADD CONTENT
Topic
Content
Source link
Name
7+1 =