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

PREVIOUS NEXT
Code Example
Csharp :: unity how to copy something to the clipboard 
Csharp :: url()- full() laravel 
Csharp :: c# windows grab screenshot 
Csharp :: how to change the color of your text in c# 
Csharp :: how to disable a gameObject unity c# 
Csharp :: urlreferrer in asp.net core 
Csharp :: enum loop 
Csharp :: unity change text 
Csharp :: unity distance between 2 vectors 2d 
Csharp :: C# string format sepperate every thousand 
Csharp :: c# convert Unix time in seconds to datetime 
Csharp :: c# random boolean 
Csharp :: c# convert string to double 
Csharp :: isletter c# 
Csharp :: button color uwp c# 
Csharp :: c# empty IEnumerable 
Csharp :: c# try catch with error message 
Csharp :: get datacontext of parent wpf 
Csharp :: radians to degree c# 
Csharp :: unity game sleep on hit 
Csharp :: c# kill all processes by name 
Csharp :: how to create a rounded custom panel c# 
Csharp :: get type of exception c# 
Csharp :: scaffold db ef core 
Csharp :: UnityEngine.Transform.get_position () (at <a0ef933b1aa54b668801ea864e4204fe:0) Gamekit3D.MeleeWeapon.BeginAttack (System.Boolean thowingAttack) 
Csharp :: c# random choice 
Csharp :: unity check if audio playing 
Csharp :: C# define a block as text 
Csharp :: c# cmd 
Csharp :: unity instantiate 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =