Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

how to disable and enable rigidbody unity

// if you want to disable the rigidbody on which the script is sitting on
// you can't do that but you can go around it by 

// Just destroying the rigidbody by calling
Destroy(gameObject.GetComponent<Rigidbody>());

// and if you want it again call
gameObject.AddComponent<Rigidbody>();

// Remember "gameObject" with small 'g' reffers to the gameObj on which the script
// is sitting on

// -*-*-*-*-*-***-HAPPY CODING-***-*-*-*-*-*-
Comment

disable rigidbody unity

//This is for Unity (c#)
Rigidbody rb; //For 2D games use 'Rigidbody2D'
  
  void Awake ()
  {
      rb = GetComponent<Rigidbody>();
  }

  // (...)
rb.bodyType = RigidbodyType2D.Static;  // Deactivated
rb.bodyType = RigidbodyType2D./*The type the rigidbody was originally eg. dynamic, kinematic, or static*/; // Activated
Comment

unity rigidbody2d disable

//you can't :(
//you can delete it with
Destroy(RigidBody2D);
Comment

disable rigidbody unity


 myPlayer.Getcomponent<Rigidbody>().isKenimatic == false;
 myPlayer.Getcomponent<Rigidbody().detectCollision = true;
 }

Comment

PREVIOUS NEXT
Code Example
Csharp :: c# goto statement 
Csharp :: System.Data.Entity.Core.EntityException: The underlying provider failed on Open 
Csharp :: get quaternion from vector unity 
Csharp :: mysqldump - date 
Csharp :: class in c# 
Csharp :: c# callback action lambda 
Csharp :: c# round to closest multiple 
Csharp :: enum in c# 
Csharp :: unity ui button 
Csharp :: print pdf in c# 
Csharp :: select distinct two columns entity framework c# 
Csharp :: dxf read c# 
Csharp :: c# datagridview set column header alignment 
Csharp :: c# generic return type in interface 
Csharp :: drop down list razor example 
Csharp :: how to cut a string in c# 
Csharp :: c# read excel file using epplus save to datatable 
Csharp :: how to check type in c# 
Csharp :: pubxml environment variables 
Csharp :: telerik mvc grid column with icon 
Csharp :: conncet oracle database in c# visual studio 
Csharp :: int model property shows 0 in textbox .net core 
Csharp :: Merge two List using Linq 
Csharp :: c# split quotation 
Csharp :: convert list to datatable c# 
Csharp :: c# multiplicate char 
Csharp :: C# checking if a value is a int 
Csharp :: Non-Serialized Fields in unity inspector 
Csharp :: c# list get last element 
Csharp :: subtract to time c# 
ADD CONTENT
Topic
Content
Source link
Name
7+1 =