Skip to content

Commit

Permalink
check the default up axis
Browse files Browse the repository at this point in the history
  • Loading branch information
cadop committed Jan 17, 2023
1 parent 476beed commit 199e481
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion exts/siborg.simulate.crowd/siborg/simulate/crowd/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,14 @@ def set_scene(self, stage):
UsdGeom.SetStageMetersPerUnit(stage, 1.0)

self.scene = UsdPhysics.Scene.Define(stage, self.defaultPrimPath + "/physicsScene")
self.scene.CreateGravityDirectionAttr().Set(Gf.Vec3f(0.0, 0.0, -1.0))
stage_axis = UsdGeom.GetStageUpAxis(stage)
gravity_dir = Gf.Vec3f(0.0, 0.0, 0)

if stage_axis is 'X': gravity_dir[0] = -1.0
if stage_axis is 'Y': gravity_dir[1] = -1.0
if stage_axis is 'Z': gravity_dir[2] = -1.0

self.scene.CreateGravityDirectionAttr().Set(gravity_dir)
self.scene.CreateGravityMagnitudeAttr().Set(9.81)

physxSceneAPI = PhysxSchema.PhysxSceneAPI.Apply(self.scene.GetPrim())
Expand Down

0 comments on commit 199e481

Please sign in to comment.