Hello,
I’m trying to get transformation from a UsdPrim using omni::connect::core::getLocalTransform() function. It seems it does not compute rotation and scale and only takes translation into account from what I can tell. Am I doing something wrong?
I’m testing with a simple cube I create with USDComposer and I apply a scale, or a rotation, but when reading the USD I don’t find the same matrix.
If I use the USD library functionalities I find the appropriate 4x4 matrix it seems:
GfMatrix4d GetGfTransform(const UsdPrim& prim) {
if (!prim) {
throw std::invalid_argument("Invalid UsdPrim provided");
}
UsdGeomXformable xformable(prim);
if (!xformable) {
throw std::invalid_argument("The provided prim is not transformable");
}
// Get the local transformation matrix
bool resetXformStack;
GfMatrix4d transformMatrix;
xformable.GetLocalTransformation(&transformMatrix, &resetXformStack);
return transformMatrix;
}
...
// xform gets wrong data
pxr::GfTransform xform = omni::connect::core::getLocalTransform(prim);
// usdXform seems better
auto usdXform = GetGfTransform(prim);