Hi, I don't think I made an example for raycasting.
It's pretty straightforward,
Add a raycaster.
add something like an always, then add some action for the raycaster.
-add a set position action for the raycaster, this sets the raycaster origin location to some xyz in world space.
-add a set direction action for the raycaster, this sets the raycaster either towards a location, or in a xyz vector direction, depending on the actions
next add a condition, either Raycast, loop all or Raycast, pick 1st.
-select a Q3D model, and set the raycaster step size (world space units) and the raycaster near/far clipping values (the raycaster will only intersect objects in the given range).
Raycast loop all will act like a loop, calling the events in the loop and acting sort of like a for each picking each object that was intersected.
Raycast pick 1st will simply pick the object in the first intersection.
When an intersection occurs, you will know because the condition returned true so the associated actions fired. if you just want to detect collisions like this just use a dummy variable and set it to 0 before checking, and 1 in the raycast condition. That way each frame you'll know if you had an intersection or not.
Last important point. Whenever an object is picked by the raycast conditions, the raycaster expressions are updated with relevant information about the raycast. Stuff like intersection location in worldspace, the normal of the face that was intersected (in world space), intersection depth, etc.
hope this helps.
If you want to do raycasting from a mouse position (i.e. to select objects with the mouse), you can use the Q3D viewport. The workflow is essentially identical to what i just described except you use the "projection" conditions. These let you give the mouse x/y position and handles all the tricky projection stuff. three.js might have a bug with this though if you're using shadows, I can't remember.