# Toggle Physics through Script

**URL:** https://discussions.unity.com/t/toggle-physics-through-script/411221
**Category:** Physics
**Tags:** Scripting
**Created:** [April 10, 2010, 12:48am UTC](https://discussions.unity.com/t/toggle-physics-through-script/411221 "2010-04-10T00:48:53Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![anon\_72233379](https://avatars.discourse-cdn.com/v4/letter/a/b2d939/32.png) [@anon\_72233379](https://discussions.unity.com/u/anon_72233379)
#### Post date: [April 10, 2010, 12:48am UTC](https://discussions.unity.com/t/toggle-physics-through-script/411221/1 "2010-04-10T00:48:53Z")

</div>

I have a large-scale physics based game I’m working on and I’d like to know if it’s possible to toggle an object’s physics if it’s more than 500~ units away. A big world can’t simulate physics everywhere, all the time, and stuff that’s over two screens away doesn’t need to be rendered. How do I toggle physics on/off?

---

<div class="post-metadata">

### Author: ![anon\_77129249](https://avatars.discourse-cdn.com/v4/letter/a/898d66/32.png) [@anon\_77129249](https://discussions.unity.com/u/anon_77129249)
#### Post date: [April 10, 2010, 1:07am UTC](https://discussions.unity.com/t/toggle-physics-through-script/411221/2 "2010-04-10T01:07:46Z")

</div>

> **[Unity - Scripting API: Rigidbody.isKinematic](https://docs.unity3d.com/ScriptReference/Rigidbody-isKinematic.html)**

You could probably toggle that if you determine an object is offscreen and of no importance to the scene

---

<div class="post-metadata">

### Author: ![anon\_72233379](https://avatars.discourse-cdn.com/v4/letter/a/b2d939/32.png) [@anon\_72233379](https://discussions.unity.com/u/anon_72233379)
#### Post date: [April 10, 2010, 2:26am UTC](https://discussions.unity.com/t/toggle-physics-through-script/411221/3 "2010-04-10T02:26:49Z")

</div>

It stops the physics movement, but it’s still sucking up the processing power ☹ Any way to disable the rigidbody component altogether?

---

<div class="post-metadata">

### Author: ![anon\_77129249](https://avatars.discourse-cdn.com/v4/letter/a/898d66/32.png) [@anon\_77129249](https://discussions.unity.com/u/anon_77129249)
#### Post date: [April 10, 2010, 2:44am UTC](https://discussions.unity.com/t/toggle-physics-through-script/411221/4 "2010-04-10T02:44:14Z")

</div>

Hmmm Well, i’m not too familiar with physics, but have you tried putting them to sleep? Not for sure if you can, but the docs are here:

> **[Unity - Scripting API: Rigidbody.Sleep](https://docs.unity3d.com/ScriptReference/Rigidbody.Sleep.html)**

Either that, or you could simply destory the rigidbod component. this might be what you need if you no longer need the object to react to physics.

> **[Unity - Scripting API: Object.Destroy](https://docs.unity3d.com/ScriptReference/Object.Destroy.html)**
