The Raycast node checks if objects enter its line of sight. This line - or ray - is visualized when the node is selected. You can change the direction of the ray by rotating the node. Attach the node to a game object and you can check if there is something in its vicinity.
To detect specific objects, have a look at their Object Groups and make sure you select the same groups in the Raycast node's Group Filters section.
Attach To | If you attach the Raycast node to an object, its line of sight will be placed at the object's location. Otherwise the line of sight is placed at the node's location. |
Execute | Executes the node |
↳ On Start | Executes the node at the start of the game. On by default. |
↳ Always | Executes the node on each frame. On by default. |
Enabled | Enable or disable the node. Disabled nodes cannot be executed |
Local Direction | When toggled on, the Raycast's direction will be automatically aligned with the attached object's direction |
Local Offset | When toggled on, Raycast's Offset will be calculated based on the node's own direction instead of global coordinates. |
Scale with Object | Increase or decrease range of the Raycast automatically based on the scale of the attached object |
All hits | When toggled on, the node will detect all objects that are in its line of sight simultaneously. When off, only the first object in line will be detected |
Group Filter | The node will react to objects that belong to selected groups |
Ignore Filter | The node will ignore objects that belong to selected groups |
Min / Max Range | Determines the minimum and maximum range of the node's line of sight |
Offset | Offset "displaces" the Raycast node's line of sight for a certain amount.This input can receive a vector from another node in order to set the Offset |
↳ X, Y & Z | Change the X, Y & Z values manually or with other logic nodes to adjust the offset |
On Hit Object | Sends a signal when Raycast hits an object. Outputs both the distance from the abject and the object reference. If All hits is toggled on, this output fires as many times as there are objects on the line of sight. |
Did Hit | Sends a signal when the node hits an object. If All hits is toggled on, this output fires as many times as there are objects on the line of sight. |
Didn't Hit | Sends a signal when the node is executed but it doesn't hit an object |
On Hit Normal Vector | Outputs the normal vector of the face of the Object that the Raycast hits on. Mainly used for reflections. If All hits is toggled on, this output fires as many times as there are objects on the line of sight. |
Here are some links to demos that show how to use the Raycast node:
Simple: https://hypehype.com/r/ZF8yD3QcgpqIKi
Advanced: https://hypehype.com/r/Z0LMEmugIHypeX