Commit 18f3ac1 1 parent fa4568b commit 18f3ac1 Copy full SHA for 18f3ac1
File tree 1 file changed +18
-1
lines changed
1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change 21
21
#include < string>
22
22
23
23
#include < pxr/base/gf/vec3f.h>
24
+ #include < pxr/usd/sdf/path.h>
25
+ #include < pxr/usd/usd/prim.h>
24
26
#include < pxr/usd/usd/stage.h>
25
27
#include < pxr/usd/usdGeom/tokens.h>
28
+ #include < pxr/usd/usdPhysics/scene.h>
29
+
30
+ #include " sdf/World.hh"
26
31
27
32
namespace usd
28
33
{
@@ -35,8 +40,20 @@ namespace usd
35
40
_stage->SetStartTimeCode (0 );
36
41
_stage->SetTimeCodesPerSecond (24 );
37
42
43
+ const pxr::SdfPath worldPrimPath (_path);
44
+ auto usdWorldPrim = _stage->DefinePrim (worldPrimPath);
45
+
46
+ auto usdPhysics = pxr::UsdPhysicsScene::Define (_stage,
47
+ pxr::SdfPath (_path + " /physics" ));
48
+ const auto &sdfWorldGravity = _world.Gravity ();
49
+ const auto normalizedGravity = sdfWorldGravity.Normalized ();
50
+ usdPhysics.CreateGravityDirectionAttr ().Set (pxr::GfVec3f (
51
+ normalizedGravity.X (), normalizedGravity.Y (), normalizedGravity.Z ()));
52
+ usdPhysics.CreateGravityMagnitudeAttr ().Set (
53
+ static_cast <float >(sdfWorldGravity.Length ()));
54
+
38
55
// TODO(ahcorde) Add parser
39
- std::cerr << " Parser is not yet implemented" << ' \n ' ;
56
+ std::cerr << " Parser for a sdf world is not yet implemented\n " ;
40
57
41
58
return true ;
42
59
}
You can’t perform that action at this time.
0 commit comments