“Désactiver l'unité rigide” Réponses codées

Comment désactiver et activer l'unité rigidbody

// 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-***-*-*-*-*-*-
Ninja Hatori Cat Codr

Désactiver l'unité rigide

//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
Ju1.js

Unity rigidbody2d Désactiver

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

Désactiver l'unité rigide


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

Adventurous Armadillo

Réponses similaires à “Désactiver l'unité rigide”

Questions similaires à “Désactiver l'unité rigide”

Plus de réponses similaires à “Désactiver l'unité rigide” dans C#

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code