Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

unity rigidbody freeze all

//For 3D Games, 2D is similar but uses Rigidbody2D, RigidbodyConstraints2D
public GameObject obj; // this is the actual game obj. Drag & drop in inspector
// or if this script is on the object, then get the transform.gameObject.
private Rigidbody rb; // this will reference the physics

void Start()
{
  	rb = obj.GetComponent<Rigidbody>(); // grabs the rigidbody
  	rb.constraints = RigidbodyConstraints.FreezeAll; // freeze rotation and pos
  	// This will freeze as script is loaded. You will have to use
  	// RigidyBodyConstraints.None to free physics.
{
Comment

unity rigidbody freeze all rotation

rigidbody.constraints = RigidbodyConstraints.FreezeRotation;
Comment

PREVIOUS NEXT
Code Example
Csharp :: get script directory c# 
Csharp :: Startup.cs class is missing in .NET 6 
Csharp :: c# program exit 
Csharp :: interop C# save as and replace 
Csharp :: c# internalsvisibleto 
Csharp :: connect to a database and loop over a recordset in C# 
Csharp :: get gameobject active state 
Csharp :: C# check if object is default 
Csharp :: sustituir un caracter de un string c# 
Csharp :: access label from another class c# 
Csharp :: disable alt + f4 in c# forms 
Csharp :: unity stop velocity movement 
Csharp :: string is int f# 
Csharp :: c# while true loop 
Csharp :: camera in raylib c# 
Csharp :: Count the Number of Duplicate Characters 
Csharp :: wpf listbox binding change style of selected item 
Csharp :: double quotes in a string c# 
Csharp :: c# property attribute 
Csharp :: how to insert data into multiple tables using asp.net c# 
Csharp :: linq convert list to another list 
Csharp :: sql server query output to json file automatically 
Csharp :: elasticsearch nested aggregation in c# 
Csharp :: c# return values 
Csharp :: c# distinct comparer multiple properties 
Csharp :: .net using appsettings variables 
Csharp :: what is int.parse in c# 
Csharp :: cloudmailin c# 
Csharp :: mock async method c# reutrnd 
Csharp :: nuget package TSETMC guide 
ADD CONTENT
Topic
Content
Source link
Name
4+9 =