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
Stage getting prim "Local to World Transform" with Python
1256 2 0- daveborck
- Member
- 19 posts
- Joined: March 2019
- Offline
- Kym Watts
- Member
- 37 posts
- Joined: Sept. 2014
- Online
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.
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.
- daveborck
- Member
- 19 posts
- Joined: March 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
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