LNXSDK/leenkx/blender/lnx/logicnode/object/LN_raycast_ray.py

35 lines
1.3 KiB
Python
Raw Normal View History

2025-01-22 16:18:30 +01:00
from lnx.logicnode.lnx_nodes import *
class RaycastRayNode(LnxLogicTreeNode):
"""Cast a Ray (Origin and direction) to return the name, location and distance of the closest object
in the object arrays
@input Obj Array: Objects to detect.
@input Origin: ray origin.
@input Direction: ray direction.
@output True: if an object is detected.
@output False: if none object is detected.
@output Object: close object detected.
@output Location: the position where the ray comes in contact with the ray.
@output Distance: distance from origin to location.
"""
bl_idname = 'LNRaycastRayNode'
bl_label = 'Raycast Ray'
lnx_section = 'props'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketAction', 'In')
self.add_input('LnxNodeSocketArray', 'Obj Array')
self.add_input('LnxVectorSocket', 'Origin')
self.add_input('LnxVectorSocket', 'Direction')
self.add_output('LnxNodeSocketAction', 'Out')
self.add_output('LnxNodeSocketAction', 'True')
self.add_output('LnxNodeSocketAction', 'False')
self.add_output('LnxNodeSocketObject', 'Object')
self.add_output('LnxVectorSocket', 'Location')
self.add_output('LnxFloatSocket', 'Distance')