diff --git a/Sources/armory/logicnode/GetAgentDataNode.hx b/Sources/armory/logicnode/GetAgentDataNode.hx new file mode 100644 index 00000000..163b1388 --- /dev/null +++ b/Sources/armory/logicnode/GetAgentDataNode.hx @@ -0,0 +1,25 @@ +package armory.logicnode; + +import iron.object.Object; + +class GetAgentDataNode extends LogicNode { + + public function new(tree: LogicTree) { + super(tree); + } + + override function get(from: Int): Float { + var object: Object = inputs[0].get(); + + assert(Error, object != null, "The object to naviagte should not be null"); + +#if arm_navigation + var agent: armory.trait.NavAgent = object.getTrait(armory.trait.NavAgent); + assert(Error, agent != null, "The object does not have NavAgent Trait"); + if(from == 0) return agent.speed; + else return agent.turnDuration; +#else + return null; +#end + } +} \ No newline at end of file diff --git a/blender/arm/logicnode/navmesh/LN_get_agent_data.py b/blender/arm/logicnode/navmesh/LN_get_agent_data.py new file mode 100644 index 00000000..b26d4f8c --- /dev/null +++ b/blender/arm/logicnode/navmesh/LN_get_agent_data.py @@ -0,0 +1,13 @@ +from arm.logicnode.arm_nodes import * + +class GetAgentDataNode(ArmLogicTreeNode): + """Gets the speed and turn duration of the agent""" + bl_idname = 'LNGetAgentDataNode' + bl_label = 'Get Agent Data' + arm_version = 1 + + def arm_init(self, context): + self.add_input('ArmNodeSocketObject', 'Object') + + self.add_output('ArmFloatSocket', 'Speed') + self.add_output('ArmFloatSocket', 'Turn Duration') \ No newline at end of file