RealityKit's ARView raycast returns nothing

Hello,

I have rendered an usdz File using sceneKit's .write() method on the displayed scene. Once I load it on another RealityKit's ARView using the .nonAR mode of the camera, I am trying to use the view's raycast(from:,allowing:,alignment:) method, to get the coordinates on the model. I have applied the collisionComponents when loading the model using the .generateCollisionShapes() function to be able to interact with the modelEntity.

However, the raycast result returns nothing.

Is there something I am missing for it to work?

Thanks!

Use "Debug Visualizations" in Xcode to confirm the collision shapes are correct. Click the small "Debug Visualizations" icon (to the right of the "step out" icon in the debug tools) and check the collision shapes option.

If the shapes look incorrect, try to generate the shapes using generateStaticMesh(from:) instead of generateCollisionShapes.

RealityKit's ARView raycast returns nothing
 
 
Q