Get Position of a Prim Object

Hi there,

How do i get the Position Values of a Prim?

The Objects in my Stage should all rotate so they are looking at a designated Cube. To calculated the different rotations needed, it is most pratical (at least to my limited knowledge of coding in omniverse) to get the position values of every Object.

Thanks in Advance!

Hi @Jens_G94. Specifically, I think you want the position in world space. You can do something like this:

from pxr import Gf
import omni.usd

stage = omni.usd.get_context().get_stage()
prim = stage.GetPrimAtPath("/World/your/xformable/prim")
matrix: Gf.Matrix4d = omni.usd.get_world_transform_matrix(prim)
translate: Gf.Vec3d = matrix.ExtractTranslation()

Thank You! That was very helpful.

Do you know if it’s possible to extract the irradience Value out of Omniverse into a variable in my script or is it possible to visualize the data via a graph inside omniverse, without hovering over a position? (it is not practically possible for me to hover over the exact same position multiple times)

Reason beeing:
The Object should rotate so they are looking at a Cube and reflect incoming light onto said cube. To track data, it would be really helpful, if it would be possible to extract the light energy at a position.

Sounds interesting. Can you start a new topic for this second question?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.