Files
LNXSDK/leenkx/blender/lnx/logicnode/navmesh/LN_go_to_location.py

36 lines
1.3 KiB
Python

from lnx.logicnode.lnx_nodes import *
class GoToLocationNode(LnxLogicTreeNode):
"""Makes a NavMesh agent go to location.
@input In: Start navigation.
@input NavMeshId: The ID of the NavMesh to use.
@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.
"""
bl_idname = 'LNGoToLocationNode'
bl_label = 'Agent Go to Location'
lnx_section = 'agent'
lnx_version = 2
def lnx_init(self, context):
self.add_input('LnxNodeSocketAction', 'In')
self.add_input('LnxStringSocket', 'NavMeshId', default_value = 'NavMesh')
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_output('LnxNodeSocketAction', 'Out')
def get_replacement_node(self, node_tree: bpy.types.NodeTree):
if self.lnx_version not in (0, 1):
raise LookupError()
return NodeReplacement.Identity(self)