Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

rigidbody2d freeze position

public Rigidbody2D rb;

void Start()
{
	rb.constraints = RigidbodyConstraints2D.FreezeAll;
}
Comment

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 :: c# add item to a lsit 
Csharp :: how to update a project to cross target .net core 
Csharp :: unity if or 
Csharp :: json property annotation c# 
Csharp :: c# fontweight in code 
Csharp :: how to store more data than doublec# 
Csharp :: public static void Load 
Csharp :: C# socket bind to dns name 
Csharp :: c# string to uri 
Csharp :: Unity C# make object face away 
Csharp :: load prefab in script unity 
Csharp :: how to open any file on button click in winforms 
Csharp :: remove last character from string c# 
Csharp :: unity how to ommit letters from a string 
Csharp :: c# winforms textbox readonly 
Csharp :: shorthand in c# operator 
Csharp :: stopwatch c# 
Csharp :: c# serviceCollection AddLogging 
Csharp :: C# regex replace all spaces with blank 
Csharp :: ask for administrative permission 
Csharp :: c# request run as administrator 
Csharp :: blazor button onclick parameter 
Csharp :: wpf update listview itemssource 
Csharp :: includes method C# 
Csharp :: dictionary to string c# 
Csharp :: get directory name of path c# 
Csharp :: bootstrap distane between col 
Csharp :: generate random string c# 
Csharp :: get date value from datepicker c# 
Csharp :: c# list index 
ADD CONTENT
Topic
Content
Source link
Name
4+5 =