Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

unity clamp rotation

float rotationX = 0;
float rotationY = 0;
// you might also have some rotation speed variable
void Update() {
   rotationX += Input.GetAxis("Vertical") * Time.deltaTime;
   rotationX = Mathf.Clamp(rotationX, minRotationX, maxRotationX);
   rotationY += Input.GetAxis("Horizontal" * Time.deltaTime;
   transform.rotation = Quaternion.Euler(rotationX, rotationY, 0);
 }
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# date 
Csharp :: c# array map 
Csharp :: unity button press onclick click add C# 
Csharp :: how to make an object invisible unity 
Csharp :: C# .net core convert to int round up 
Csharp :: how to start cmd in c# 
Csharp :: unity random range 
Csharp :: decimal to string c# 
Csharp :: unity check if a animator parameter trigger is activated 
Csharp :: c# hello world 
Csharp :: c# get user appdata folder 
Csharp :: function in Razor Pages 
Csharp :: VLC .net 
Csharp :: https port 
Csharp :: linq distinct count 
Csharp :: c# datagridview search filter 
Csharp :: how to move a gameobject to another object 
Csharp :: how to split concat string c# 
Csharp :: c# compress string 
Csharp :: cannot convert from string to type T 
Csharp :: instantiate list c# 
Csharp :: C# Program For Check Total Occurrence Of A Number In An Array 
Csharp :: how to set rigidbody velocity in unity 
Csharp :: c# list string return concatenate 
Csharp :: if in dictionary c# 
Csharp :: c# jobject to string 
Csharp :: c# underscore variable 
Csharp :: press key run code unity c# 
Csharp :: 2 rotation unity 
Csharp :: c# list length 
ADD CONTENT
Topic
Content
Source link
Name
9+5 =