How to get the position of the rigid body


I built a simple model following the method in the diagram, but the translate information read by the Read Prim Attribute node is always 0.

Hi,
not sure how to implement that with a node, maybe someone else can help with that. But this is the code I use:

This is for global position.

def get_global_translate(prim: Usd.Prim):
        xform = UsdGeom.Xformable(prim)
        global_transform: Gf.Matrix4d = xform.ComputeLocalToWorldTransform(0)
        translate: Gf.Vec3d = global_transform.ExtractTranslation()
        return translate

You could use GetAttribute for the local position:

position_attribute = self.camera_prim.GetAttribute('xformOp:translate') 
position = position_attribute.Get()