- Home /
Answer by insominx · Mar 06, 2013 at 07:57 PM
In Unity 4.0+ rigidbody.active is deprecated and may no longer be available but you can do this:
rigidbody.detectionCollisions = false;
Unity 4.1.5f does not give any warning when using rigidbody.active = false I further checked the change log and I can not find where it says it is deprecated. But there is no mention of rigidbody.active in the script docs
That's true. Neither does the hint since 4.2 say that this is the way to go. Ins$$anonymous$$d it drops a silly message : 'obsolete, use enabled for enabling / disabling components' <- DOES NOT WOR$$anonymous$$ :D
This is far more similar to
enabled = false
than removing the component (or setting it to kinematic). Thanks!
Isn't it supposed to read: rigidbody.**detect**Collisions = false;
This is deprecated in Unity 5+, use rigidbody.is$$anonymous$$inematic = false ins$$anonymous$$d
I am using 5.5.3f1 and it is not deprecated.
Answer by dcocchia · Apr 14, 2012 at 10:35 PM
You probably just want to do .rigidbody.isKinematic = true.
Answer by Eric5h5 · Dec 26, 2010 at 08:21 PM
You can't enable or disable rigidbody, but you can destroy it with Destroy and add it back with AddComponent.
Unfortunately, you can't if you have something depending on it, like a CharacterJoint, so you're screwed on ragdolls. Doing rigidbody.is$$anonymous$$inematic = true will give the desired behavior, but at a significant performance penalty, even with paired collider disabled.
@ Eric5h5 thanks sooo much, I did not know you could destroy and add a rigidbody to a gameobject, now I only have one problem, is there a way to change settings for the rigidbody when you add it the gameobject? I need to freeze the rotation on the z axis.
Answer by jchart7 · Mar 08, 2015 at 04:11 PM
Ref: http://docs.unity3d.com/ScriptReference/Rigidbody-isKinematic.html
using UnityEngine;
using System.Collections;
public class ExampleClass : MonoBehaviour {
public Rigidbody rb;
void Start() {
rb = GetComponent<Rigidbody>();
}
void EnableRagdoll() {
rb.isKinematic = false;
rb.detectCollisions = true;
}
void DisableRagdoll() {
rb.isKinematic = true;
rb.detectCollisions = false;
}
}enter code here
Answer by bawi · Aug 26, 2011 at 08:29 AM
can we add "Add Component" on the selected game object we want? how?
Your answer
Follow this Question
Related Questions
Disable Rigidbody Function Start 1 Answer
Rigidbody velocity limiter 0 Answers
Connect two rigidbody gameobjects together at runtime? 0 Answers
Disabling isKinematic on a hinge joint at runtime - keeping motion to axis 0 Answers
Temporarily removing rigidbody and configurable joint and then replacing them 0 Answers