forked from LeenkxTeam/LNXSDK
		
	
		
			
				
	
	
		
			45 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			45 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
| from lnx.logicnode.lnx_nodes import *
 | |
| 
 | |
| class GoToLocationNode(LnxLogicTreeNode):
 | |
|     """Makes a NavMesh agent go to location.
 | |
| 
 | |
|     @input In: Start navigation.
 | |
|     @input Object: The object to navigate. Object must have `NavAgent` trait applied.
 | |
|     @input Location: Closest point on the navmesh to navigate to.
 | |
|     @input Speed: Rate of movement.
 | |
|     @input Turn Duration: Rate of turn.
 | |
|     @input Height Offset: Height of the object from the navmesh.
 | |
|     @input Use Raycast: Use physics ray cast to get more precise z positioning.
 | |
|     @input Ray Cast Depth: Depth of ray cast from the object origin.
 | |
|     @input Ray Cast Mask: Ray cast mask for collision detection.
 | |
| 
 | |
|     @output Out: Executed immidiately after start of the navigation.
 | |
|     @output Tick Position: Executed at every step of navigation translation.
 | |
|     @output Tick Rotation: Executed at every step of navigation rotation.
 | |
|     """
 | |
|     bl_idname = 'LNGoToLocationNode'
 | |
|     bl_label = 'Go to Location'
 | |
|     lnx_version = 2
 | |
| 
 | |
|     def lnx_init(self, context):
 | |
|         self.add_input('LnxNodeSocketAction', 'In')
 | |
|         self.add_input('LnxNodeSocketObject', 'Object')
 | |
|         self.add_input('LnxVectorSocket', 'Location')
 | |
|         self.add_input('LnxFloatSocket', 'Speed', 5.0)
 | |
|         self.add_input('LnxFloatSocket', 'Turn Duration', 0.4)
 | |
|         self.add_input('LnxFloatSocket', 'Height Offset', 0.0)
 | |
|         self.add_input('LnxBoolSocket','Use Raycast')
 | |
|         self.add_input('LnxFloatSocket', 'Ray Cast Depth', -5.0)
 | |
|         self.add_input('LnxIntSocket', 'Ray Cast Mask', 1)
 | |
| 
 | |
|         self.add_output('LnxNodeSocketAction', 'Out')
 | |
|         self.add_output('LnxNodeSocketAction', 'Tick Position')
 | |
|         self.add_output('LnxNodeSocketAction', 'Tick Rotation')
 | |
| 
 | |
|     def get_replacement_node(self, node_tree: bpy.types.NodeTree):
 | |
|         if self.lnx_version not in (0, 1):
 | |
|             raise LookupError()
 | |
| 
 | |
|         return NodeReplacement.Identity(self)
 | |
| 
 |