“Unity Rigidbody Freeze TOUS” Réponses codées

Rigidbody2d Freeze Position

public Rigidbody2D rb;

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

Unity Rigidbody Freeze TOUS

//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.
{
Joshua Patterson

Unity Rigidbody Greeze toute rotation

rigidbody.constraints = RigidbodyConstraints.FreezeRotation;
mehmet köksal

Réponses similaires à “Unity Rigidbody Freeze TOUS”

Questions similaires à “Unity Rigidbody Freeze TOUS”

Plus de réponses similaires à “Unity Rigidbody Freeze TOUS” dans C#

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code