# Add rigidbody with python no property disable gravity RAW USD properties

**URL:** <https://forums.developer.nvidia.com/t/add-rigidbody-with-python-no-property-disable-gravity-raw-usd-properties/264859>\
**Category:** Isaac Sim\
**Tags:** isaacsim, physx, python, usd\
**Created:** [August 30, 2023, 9:10am UTC](https://forums.developer.nvidia.com/t/add-rigidbody-with-python-no-property-disable-gravity-raw-usd-properties/264859 "2023-08-30T09:10:33Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![nickbakker40](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@nickbakker40](https://forums.developer.nvidia.com/u/nickbakker40)\
**Post date:** [August 30, 2023, 9:10am UTC](https://forums.developer.nvidia.com/t/add-rigidbody-with-python-no-property-disable-gravity-raw-usd-properties/264859/1 "2023-08-30T09:10:33Z")

</div>

Hello,

In my simulation I add a rigid body to a Xform with python code (UsdPhysics.RigidBodyAPI.Apply(prim)). The next step is to disable the gravity for that specific rigid body.

I know that you can get and set properties/attributes of a prim and also that you have a function to get all the properties of a prim. When I get all the properties I don’t see the property disable gravity. I investigated further and I found out the you can only get the RAW USD properties of a prim.

I also found out that when you add a RigidBody with the GUI it adds the disable gravity to the RAW USD properties but this doesn’t happen when you do it with python code.

So my question is now why is disable gravity not a RAW USD property when added with python code and can I still set the value of disable gravity to True with python code when it is not a RAW USD property?

Thanks in advance

---

<div class="post-metadata">

**Author:** ![nickbakker40](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@nickbakker40](https://forums.developer.nvidia.com/u/nickbakker40)\
**Post date:** [August 30, 2023, 11:40am UTC](https://forums.developer.nvidia.com/t/add-rigidbody-with-python-no-property-disable-gravity-raw-usd-properties/264859/2 "2023-08-30T11:40:12Z")

</div>

Note: It adds some of the properties from the Rigid body but not all (see pictures). But when I press the checkbox of disable gravity in the GUI of Isaac Sim, it adds all the properties to the RAW USD properties tab.

 ![image](https://global.discourse-cdn.com/nvidia/original/4X/d/6/a/d6a337d0fab1e7bc20b42ddb784472804575e625.png)

 ![image](https://global.discourse-cdn.com/nvidia/original/4X/c/3/3/c337d202d14616fe064b78828ef25a20c4f8a609.png)

---

<div class="post-metadata">

**Author:** ![dan.sandberg](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@dan.sandberg](https://forums.developer.nvidia.com/u/dan.sandberg)\
**Post date:** [September 1, 2023, 8:10am UTC](https://forums.developer.nvidia.com/t/add-rigidbody-with-python-no-property-disable-gravity-raw-usd-properties/264859/3 "2023-09-01T08:10:08Z")

</div>

I would like to understand this as well.

---

<div class="post-metadata">

**Author:** ![toni.sm](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/toni.sm/32/27559_2.png) [@toni.sm](https://forums.developer.nvidia.com/u/toni.sm)\
**Post date:** [September 2, 2023, 1:59pm UTC](https://forums.developer.nvidia.com/t/add-rigidbody-with-python-no-property-disable-gravity-raw-usd-properties/264859/5 "2023-09-02T13:59:03Z")

</div>

Hi @nickbakker40 and @nickbakker40

In order to add the rigid body [schema](https://openusd.org/release/glossary.html#usdglossary-schema) to get and set values from Python code you need also to call the `PhysxSchema.PhysxRigidBodyAPI.Apply(prim)` function.

Example (assuming that the `"/World/Xform"` exists):

```python
import omni.usd
from pxr import UsdPhysics, PhysxSchema

stage = omni.usd.get_context().get_stage()
prim = stage.GetPrimAtPath("/World/Xform")

# apply rigid body API and schema
physicsAPI = UsdPhysics.RigidBodyAPI.Apply(prim)
PhysxSchema.PhysxRigidBodyAPI.Apply(prim)

attr = prim.GetAttribute("physxRigidBody:disableGravity")
print(attr)

```

The kit command `AddPhysicsComponentCommand` (called via _Add \> Physics \> Rigid Body_ context menu) apply those steps

```python
import omni
import omni.usd

stage = omni.usd.get_context().get_stage()
prim = stage.GetPrimAtPath("/World/Xform")

# apply rigid body API and schema
omni.kit.commands.execute("AddPhysicsComponentCommand",
                          usd_prim=prim,
                          component="PhysicsRigidBodyAPI")

attr = prim.GetAttribute("physxRigidBody:disableGravity")
print(attr)

```

---

<div class="post-metadata">

**Author:** ![AlesBorovicka](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/alesborovicka/32/21824_2.png) [@AlesBorovicka](https://forums.developer.nvidia.com/u/AlesBorovicka)\
**Post date:** [September 4, 2023, 6:34am UTC](https://forums.developer.nvidia.com/t/add-rigidbody-with-python-no-property-disable-gravity-raw-usd-properties/264859/6 "2023-09-04T06:34:16Z")

</div>

Yes, that is correct. The UsdPhysics schema contains just a very small subset of attributes. Pretty much the most common one. All the additional parameters are defined through PhysxSchemas, so you apply additional API to extend the parameters.  
You can check the schema documentation:  
[http://omniverse-docs.s3-website-us-east-1.amazonaws.com/omni\_usd\_schema\_physics/105.0/index.html](http://omniverse-docs.s3-website-us-east-1.amazonaws.com/omni_usd_schema_physics/105.0/index.html)

Regards,  
Ales

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/system/32/68080_2.png) [@system](https://forums.developer.nvidia.com/u/system)\
**Post date:** [September 18, 2023, 6:34am UTC](https://forums.developer.nvidia.com/t/add-rigidbody-with-python-no-property-disable-gravity-raw-usd-properties/264859/7 "2023-09-18T06:34:24Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
