2020-10-05 19:55:56 +02:00
|
|
|
from arm.logicnode.arm_nodes import *
|
|
|
|
|
|
|
|
class PickObjectNode(ArmLogicTreeNode):
|
2021-02-19 19:42:18 +01:00
|
|
|
"""Picks the rigid body in the given location using the screen
|
|
|
|
coordinates (2D).
|
2021-07-20 20:53:22 +02:00
|
|
|
|
2021-02-19 19:42:18 +01:00
|
|
|
@seeNode Mask
|
2021-07-20 20:53:22 +02:00
|
|
|
|
|
|
|
@input Screen Coords: the location at which to pick, in screen
|
2021-02-19 19:42:18 +01:00
|
|
|
coordinates
|
|
|
|
@input Mask: a bit mask value to specify which
|
|
|
|
objects are considered
|
2021-07-20 20:53:22 +02:00
|
|
|
|
2021-02-19 19:42:18 +01:00
|
|
|
@output RB: the object that was hit
|
|
|
|
@output Hit: the hit position in world coordinates
|
2021-10-31 23:06:11 +01:00
|
|
|
@output Normal: the hit normal in world coordinates
|
2021-02-19 19:42:18 +01:00
|
|
|
"""
|
2020-10-05 19:55:56 +02:00
|
|
|
bl_idname = 'LNPickObjectNode'
|
|
|
|
bl_label = 'Pick RB'
|
2020-10-27 19:44:37 +01:00
|
|
|
arm_section = 'ray'
|
2021-10-31 23:06:11 +01:00
|
|
|
arm_version = 2
|
2020-10-05 19:55:56 +02:00
|
|
|
|
2021-07-20 20:53:22 +02:00
|
|
|
def arm_init(self, context):
|
2021-07-10 21:46:44 +02:00
|
|
|
self.add_input('ArmVectorSocket', 'Screen Coords')
|
|
|
|
self.add_input('ArmIntSocket', 'Mask', default_value=1)
|
2020-11-17 16:01:15 +01:00
|
|
|
|
2020-10-05 19:55:56 +02:00
|
|
|
self.add_output('ArmNodeSocketObject', 'RB')
|
2021-07-10 21:46:44 +02:00
|
|
|
self.add_output('ArmVectorSocket', 'Hit')
|
2021-10-31 23:06:11 +01:00
|
|
|
self.add_output('ArmVectorSocket', 'Normal')
|