Stage getting prim "Local to World Transform" with Python

   655   2   0
User Avatar
Member
16 posts
Joined: 3月 2019
Offline
Hi!

Does anyone have a python code snippet getting rotation value of "Local to World Transform" visible in violet color in Scene Graph Details?


Any help would be greatly appreciated
User Avatar
Member
34 posts
Joined: 9月 2014
Offline
I recommend this example from nvidia; https://docs.omniverse.nvidia.com/dev-guide/latest/programmer_ref/usd/transforms/get-world-transforms.html [docs.omniverse.nvidia.com]

You need to get an xformable object, then you can get the 'ComputeLocalToWorldTransform(time)' method. This example will also show you what else you can pull out of the xformable.

Cheers
Kym.
User Avatar
Member
16 posts
Joined: 3月 2019
Offline
Thanks for the link Kym!

I tried that snippet and got correct translation value but rotation retrieved with:
rotation: Gf.Rotation = world_transform.ExtractRotation()
gives me 3 axis and an angle but I am having hard time converting it to euler rotation that values would match those from Scene Graph Details. I tried Decompose() function but it was throwing an error. Probably doing something silly there.
Any hints how should I approach that?

Cheers!
Dawid
  • Quick Links