Disabling a rigidbody.

How do I disable a rigidbody? If I do rigidbody.active, it tells me to use enabled instead. But rigidbody doesn't have enabled property.

5 Answers

5

What does "disable" mean, to you? Changing to kinematic with a trigger collider is the closest you can come, other than disabling the entire Game Object or destroying the component.

I have a similar problem with rigidbodies. My game engine as far as collisions are concerned are using the Collision() methods, which always require convex rigidbodies (as far as I can tell)

My problem is whilst handling all velocities, positioning myself that the rigidbodies interfere with eachother as they are conscript of Unity3d’s physics engine. This occurs rarely as I’m using settings which minimise reactions from the physics engine, however…

It’s bad enough having to use rigidbodies to use the Collisions class functions but is there a way to totally disable physics?

(The previous answer here is a little inadequate as it recommends disabling the GameObject or destroying a needed component)

huh? if you don't want to use a game engine, and don't want to use PhysX, then don't use a game engine. just program using Corona or something else, or just move images around raw as an XCode project. you talk about calculating your own velocities, positions etc. that's just kind of weird. you just use PhysX to do all that. if you don't want to use rigidbodies - don't use them. if you don't want to use colliders - don't use them.

I like Unity3d… personally I feel a bit beaten back by your comment, and so would others.

I wanted to calculate all my own velocities and positions because of the nature of my project.

I have no idea what you mean by using XCode.

I’ve seen similar posts to mine about collisions not being accessible without rigidbodies. This is my main complaint of Unity3d and I’ve coded a workaround if there is no solution for turning physics off. I do want to use Colliders. Not Rigidbodies.

By god, there are many reasons to use Unity3d… not only for PhysX!

Your post is totally deconstructive from a programming point of view.

PS pls post comments as comments, not new answers

I’d like to apoligise and let you know the point I raised earlier, was fallible.

Although you can’t “turn off physics” for using Collider function classes and you do need a Rigidbody:

You can turn effects of physics off by clicking in the Rigidbody dialog freeze positions X,Y,Z and likewise for freeze rotations.

You can edit the positions and rotations by coding them in the usual way, whilst using this feature.

there's no need to apolgise, for goodness sake! BTW if possible please just click the SMALL COMMENT BUTTON to comment rather than using a new "answer" you can do what you say but people will think you're a pervert :) Just FTR you can always achieve the same by just setting the velocity of the rigidbody (every FixedUpdate, if you particularly want to). But ENJOY !

yourRigidbody.constraints = RigidbodyConstraints.FreezeAll;

or

yourRigidbody.constraints = RigidbodyConstraints.FreezePosition;
yourRigidbody.constraints = RigidbodyConstraints.FreezeRotation;