forked from LeenkxTeam/LNXSDK
		
	
		
			
	
	
		
			34 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
		
		
			
		
	
	
			34 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
| 
								 | 
							
								from lnx.logicnode.lnx_nodes import *
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								class PickObjectNode(LnxLogicTreeNode):
							 | 
						||
| 
								 | 
							
								    """Picks the rigid body in the given location using the screen
							 | 
						||
| 
								 | 
							
								    coordinates (2D).
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    @seeNode Mask
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    @input Screen Coords: the location at which to pick, in screen
							 | 
						||
| 
								 | 
							
								        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 hit normal in world coordinates
							 | 
						||
| 
								 | 
							
								    """
							 | 
						||
| 
								 | 
							
								    bl_idname = 'LNPickObjectNode'
							 | 
						||
| 
								 | 
							
								    bl_label = 'Pick RB'
							 | 
						||
| 
								 | 
							
								    lnx_section = 'ray'
							 | 
						||
| 
								 | 
							
								    lnx_version = 2
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    def lnx_init(self, context):
							 | 
						||
| 
								 | 
							
								        self.add_input('LnxVectorSocket', 'Screen Coords')
							 | 
						||
| 
								 | 
							
								        self.add_input('LnxIntSocket', 'Mask', default_value=1)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        self.add_output('LnxNodeSocketObject', 'RB')
							 | 
						||
| 
								 | 
							
								        self.add_output('LnxVectorSocket', 'Hit')
							 | 
						||
| 
								 | 
							
								        self.add_output('LnxVectorSocket', 'Normal')
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    def get_replacement_node(self, node_tree: bpy.types.NodeTree):
							 | 
						||
| 
								 | 
							
								        return NodeReplacement.Identity(self)
							 |