I am trying to set up a conveyor belt pipeline where at the end of the conveyor belt I have set up a container where my prims can go. I tried to build a logic in the action graph so that as my prim reaches the container, it calculates the Distance3d between prim and container and if it is less than a certain threshold, the prim is transported back to the initial position.
The issue is, that I am not able to get the continuously updated position of the prim. When I start the simulation, the position remains fixed at the initial pos. I did some research and found out that it is due to the Physics fabric. I turned that off in Preferences>Physics Fabric. But this broke a conical force field I had setup.
How can I get the continuous position of my prim in the action graph without breaking any other physics component?
Yes, correct for high performance transformation update Fabric is used.
Since you are using action graph you should be able to access the raw transformation attribute in Fabric. Action should be able to read the fabric data, the attributes you are interested in are:
_worldPosition
_worldOrientation
If this for some reason not work for you, you can access the transformation data directly from PhysX SDK through python API, this might not be the best perf wise solution:
curr_transform = get_physx_interface().get_rigidbody_transformation(str(path))
rv_success = curr_transform["ret_val"]
if rv_success:
curr_pos_f3 = curr_transform["position"]
curr_pos = Gf.Vec3d(curr_pos_f3[0], curr_pos_f3[1], curr_pos_f3[2])
curr_rot_f4 = curr_transform["rotation"]
curr_rot_quat = Gf.Quatd(curr_rot_f4[3], curr_rot_f4[0], curr_rot_f4[1], curr_rot_f4[2])
Additionally you could also use USDRT API to access the _worldPosition/_worldOrientation attributes.
But access to the attributes should work through the graph.
Regards,
Ales
Oh ok. I did try accessing the transform attribute in the action graph using get prim local to world transform node then pass that through a get translation node to get the X,Y,Z transform. But when I ran the simulation the transform were still static. Is there something I am doing wrong?
I did try accessing the prim position in action graph using both read Prim attribute node as well as Get prim local to world transform node, but both these method are giving me the initial position of the prim, and not giving the continuous updated position. How can i use the action graph for getting that?
Ok I was playing with the action graph and manage to get it working in the end, looks like things dont work out of the box.
So here are the steps:
- On the prim you need to get the transformation right click Add->Attribute, add _worldPosition, Double3 type.
- In Action Graph add node scene graph Read Prim Attribute
There you specify the prim and the attribute should be _worldPosition, then it should read the position correctly during simulation.
Regards,
Ales
Thanks a lot! It is working fine now. Also can you let me know what is the correct data type of _worldOrientation?
Oh yes, _worldOrientation should be quatf.
