Raycaster

https://user-images.githubusercontent.com/14288520/197017155-eeab3d4b-618b-49cf-8443-868f13ca18c7.png

Functionality

Functionality is almost completely analogous to the two built-in blender operators bpy.context.scene.ray_cast and object.ray_cast. Ray is casted from “start” vector to “end” vector and can hit polygons of input objects.

see docs: bpy.types.Object.ray_cast and bpy.types.Scene.ray_cast

Input sockets

  • Verts - Vectors of objects receiving rays

  • Faces - Faces of objects receiving rays

  • Start - Start position of raytracing

  • Direction - Direction of raytracing

https://user-images.githubusercontent.com/14288520/197019680-4183c4b0-cec0-4e81-80d9-10e0696a08ec.png

Output sockets

socket name

description

Location

Hit location for every raycast

Normal

Normal of hit polygon

Index

index of hit polygon

Distance

Distance between start point and hit location

Success

True or False if ray doesn’t hit any polygon.

https://user-images.githubusercontent.com/14288520/197022372-b39810a8-aae8-40fd-83ef-6b8dddaab9d6.png

Advanced parameters (N-Panel)

  • All Triangles: Enable if all the incoming faces are triangles to improve the performance of the algorithm

  • Safe Check: Checks the mesh for unreferenced polygons (slows the node but prevents some Blender crashes)

Usage

https://user-images.githubusercontent.com/14288520/197025123-e1c7f09d-3338-4164-937e-ceae59966a0a.png
https://user-images.githubusercontent.com/28003269/38853349-08514386-422e-11e8-8444-72101d9b0ade.png https://user-images.githubusercontent.com/28003269/38853243-b2dc87a8-422d-11e8-96df-7d27735a5b67.gif

calculating shadow.blend.zip

Replay with new nodes

https://user-images.githubusercontent.com/14288520/197069114-b458a783-a921-4d34-a4db-8b49b8d6c76e.gif https://user-images.githubusercontent.com/14288520/197073636-3331852c-150d-4883-8c0d-303562d5066b.png