pxr.Gf.Ray intersection with bounding box.

   1151   1   0
User Avatar
Member
39 posts
Joined: 1月 2012
Offline
I am writing a python state in a lop node that needs to raycast into the scene viewer.

I can't find anything in stateutils to assist with this, so I am rolling my own, and am having issues getting GfRay to work as expected.

  • I have constructed a GfRay passing in two vectors for start/end.
  • I have constructed UsdGeomBBoxCache's for the prims on the stage.
  • I am calling the GfRay's Intersect method, and passing in a GfRange3d, as the signature does not support a UsdGeomBBoxCache. I am calling ComputeAlignedBox on the UsdGeomBBoxCache's to get the GfRange3d.

The intersection seems to return true no matter where I position my start/end vectors.

hip file attached to demonstrate what I am trying to achieve outside of the state.

Cheers,
Aaron.
Edited by aaronauty - 2020年10月23日 08:51:39

Attachments:
gf_ray_intersect_range3d.hiplc (298.3 KB)

www.aaronauty.com
User Avatar
Member
39 posts
Joined: 1月 2012
Offline
I was able to solve this using sop verbs to build the hou.Geometry() object from the UsdGeomBBoxCache's , and use the stateutils.sopGeometryIntersection method.
www.aaronauty.com
  • Quick Links