armory/blender/arm/logicnode/physics/LN_ray_cast.py
knowledgenude 9a29adb176 fix
2020-11-17 13:01:08 -03:00

33 lines
1.1 KiB
Python

from arm.logicnode.arm_nodes import *
class RayCastNode(ArmLogicTreeNode):
"""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'
arm_section = 'ray'
arm_version = 1
def init(self, context):
super(RayCastNode, self).init(context)
self.add_input('NodeSocketVector', 'From')
self.add_input('NodeSocketVector', 'To')
self.add_input('NodeSocketInt', 'Mask', default_value=1)
self.add_output('ArmNodeSocketObject', 'RB')
self.add_output('NodeSocketVector', 'Hit')
self.add_output('NodeSocketVector', 'Normal')