2025-01-22 16:18:30 +01:00
|
|
|
from lnx.logicnode.lnx_nodes import *
|
|
|
|
|
|
|
|
|
|
class GoToLocationNode(LnxLogicTreeNode):
|
|
|
|
|
"""Makes a NavMesh agent go to location.
|
|
|
|
|
|
|
|
|
|
@input In: Start navigation.
|
2026-09-04 10:46:13 -07:00
|
|
|
@input NavMeshId: The ID of the NavMesh to use.
|
2025-01-22 16:18:30 +01:00
|
|
|
@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'
|
2026-09-04 10:46:13 -07:00
|
|
|
bl_label = 'Agent Go to Location'
|
|
|
|
|
lnx_section = 'agent'
|
2025-01-22 16:18:30 +01:00
|
|
|
lnx_version = 2
|
|
|
|
|
|
|
|
|
|
def lnx_init(self, context):
|
|
|
|
|
self.add_input('LnxNodeSocketAction', 'In')
|
2026-09-04 10:46:13 -07:00
|
|
|
self.add_input('LnxStringSocket', 'NavMeshId', default_value = 'NavMesh')
|
2025-01-22 16:18:30 +01:00
|
|
|
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)
|
|
|
|
|
|