Drag Force Field - SimulationApp paradigm - omni.issac.core & omni.material

I’m working with Isaac Sim 4.2.0 and have successfully simulated the trajectory of a DynamicSphere (RigidBody) launched from the origin(0.0, 0.0, 0.0) with a specific initial velocity (with y and z components), saving the position data at each step to a .npy file using the SimulationApp paradigm.


Now, I need to incorporate air resistance. I come across the Force Field - Drag documentation and another user topic related to Wind Force Fields.

My question revolves around integrating this Force Field using Python scripting within my existing SimulationApp-based setup. I’m trying to avoid the very low-level prim manipulation shown in some PhysX examples (like extsPhysics/omni.physx.forcefields/omni/physxforcefields/scripts/tests.py) and stick closer to the omni.isaac.core and examples utilities if possible.

I attempted to add the Force Field prim and configure its schema (ForceFieldSchema) in my script, but the resulting .npy trajectories are identical to those without the force field, indicating it’s not being applied.

I suspect setting up the equivalent scene via the GUI might work correctly, but I need the programmatic control and the ability to easily save trajectory data step-by-step to a .npy file, which is already working in my script.

Could someone provide guidance or point me towards an example of correctly adding and enabling a ForceFieldDrag (or any force field) programmatically within a SimulationApp workflow so that it affects rigid bodies? Is there a specific step I might be missing? I have attached the python script that I am using for your reference (zipped).
projectile_drag_force_field.py.zip (3.6 KB)

Thanks for any assistance!

Isaac Sim Version

4.2.0

Operating System

Ubuntu 22.04

GPU Information

  • Model: RTX 4500 Ada Generation
  • Driver Version: 535.183.01

A crucial but potentially overlooked step, not always prominent in NVIDIA tutorials or documentation see Collections section, is defining which objects the force field should influence. This is done using the Usd.CollectionAPI on the force field prim itself.

You need to:

  1. Get the Usd.Prim for your force field (e.g., dragprim).

  2. Apply the Usd.CollectionAPI to this prim, using the specific collection name ForceFieldSchema.Tokens.forceFieldBodies. The physics system looks for this exactcollection name on the force field prim.

  3. Add the target paths (like /World or specific geometry paths) to the includes relationship of this collection.

# Assume 'dragprim' is the Usd.Prim representing your force field

# 1. Apply the CollectionAPI to the force field prim.
#    Crucially, use the 'forceFieldBodies' token as the collection name.
collectionAPI = Usd.CollectionAPI.Apply(dragprim, ForceFieldSchema.Tokens.forceFieldBodies)

# 2. Define the scope: Add target paths to the collection's 'includes' relationship.
#    This example makes the force field affect everything under the /World path.
includesRel = collectionAPI.CreateIncludesRel()
includesRel.AddTarget(Sdf.Path("/World")) # You could target specific prims instead

# Now the force field represented by 'dragprim' knows to affect objects within /World.