Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

how to cap rigidbody velocity

     public float maxSpeed = 10f;
	 public Rigidbody rigidbody;
 
     void Update()
     {
         // Trying to Limit Speed
         if(rigidbody.velocity.magnitude > maxSpeed){
             rigidbody.velocity = Vector3.ClampMagnitude(rigidbody.velocity, maxSpeed);
         }
     }
Comment

PREVIOUS NEXT
Code Example
Csharp :: single line and multiline comments in c 
Csharp :: get file extension in c# file upload 
Csharp :: unity create empty gameobject in code 
Csharp :: switch expression c# 
Csharp :: How does works Unity interfaces 
Csharp :: parent unity 
Csharp :: unity get game version 
Csharp :: change column name in datatable C# 
Csharp :: how to know character is a digit or not in c# 
Csharp :: c# load form 
Csharp :: c# get excel column number from letter 
Csharp :: How to catch Entity Framework Errors C# 
Csharp :: c# sort for loop 
Csharp :: C# return and set multiple values from method 
Csharp :: unity create 3d object in script 
Csharp :: how to print statement in c# 
Csharp :: array sort C Sharp 
Csharp :: how to append something to a string in c# 
Csharp :: c# array max 
Csharp :: priority queue c# 
Csharp :: blazor ref to component in if 
Csharp :: msbuild publish to folder command line .net 
Csharp :: unity rigid body variable 
Csharp :: emgucv open image c# 
Csharp :: how to turn a string in a char list c# 
Csharp :: c# string to float 
Csharp :: should i learn c # 
Csharp :: c# check if array contains value 
Csharp :: Metadata publishing for this service is currently disabled 
Csharp :: c# delete files 
ADD CONTENT
Topic
Content
Source link
Name
2+5 =