forked from LeenkxTeam/LNXSDK
33 lines
1.0 KiB
Python
33 lines
1.0 KiB
Python
from lnx.logicnode.lnx_nodes import *
|
|
|
|
class RayCastNode(LnxLogicTreeNode):
|
|
"""Casts a physics ray and returns the first object that is hit by
|
|
this ray.
|
|
|
|
@seeNode Mask
|
|
|
|
@input From: the location from where to start the ray, in world
|
|
coordinates
|
|
@input To: the target location of the ray, in world coordinates
|
|
@input Mask: a bit mask value to specify which
|
|
objects are considered
|
|
|
|
@output RB: the object that was hit
|
|
@output Hit: the hit position in world coordinates
|
|
@output Normal: the surface normal of the hit position relative to
|
|
the world
|
|
"""
|
|
bl_idname = 'LNCastPhysicsRayNode'
|
|
bl_label = 'Ray Cast'
|
|
lnx_section = 'ray'
|
|
lnx_version = 1
|
|
|
|
def lnx_init(self, context):
|
|
self.add_input('LnxVectorSocket', 'From')
|
|
self.add_input('LnxVectorSocket', 'To')
|
|
self.add_input('LnxIntSocket', 'Mask', default_value=1)
|
|
|
|
self.add_output('LnxNodeSocketObject', 'RB')
|
|
self.add_output('LnxVectorSocket', 'Hit')
|
|
self.add_output('LnxVectorSocket', 'Normal')
|