From f728755d1383e39979d0952b56a1f13741470248 Mon Sep 17 00:00:00 2001 From: Simonrazer Date: Wed, 15 Aug 2018 09:52:27 +0200 Subject: [PATCH] abort for lerp --- Sources/armory/logicnode/LerpVectorsNode.hx | 14 ++++++++++---- blender.py | 1 + 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Sources/armory/logicnode/LerpVectorsNode.hx b/Sources/armory/logicnode/LerpVectorsNode.hx index 32312cd..973e7ec 100644 --- a/Sources/armory/logicnode/LerpVectorsNode.hx +++ b/Sources/armory/logicnode/LerpVectorsNode.hx @@ -10,6 +10,7 @@ class LerpVectorsNode extends LogicNode { var t=0.0; var c:Float; var f=0.0; + var abo:Bool; public function new(tree:LogicTree) { super(tree); @@ -19,16 +20,21 @@ class LerpVectorsNode extends LogicNode { v1 = inputs[1].get(); v2 = inputs[2].get(); t = inputs[3].get(); - f = (t / iron.system.Time.delta); + + f = (t / iron.system.Time.delta); } - override function get(from:Int):Dynamic { + override function get(from:Int):Dynamic { + abo = inputs[4].get(); + trace(t); + if (abo) { + t = 0; + } if (v1==null) { return null; c=1; } - if (t>=0) { - trace(t); + if (t>0) { v.x=v1.x+((v2.x-v1.x)/f)*c; v.y=v1.y+((v2.y-v1.y)/f)*c; v.z=v1.z+((v2.z-v1.z)/f)*c; diff --git a/blender.py b/blender.py index 42827cc..413e2d8 100644 --- a/blender.py +++ b/blender.py @@ -234,6 +234,7 @@ def init(self, context): self.inputs.new('NodeSocketVector', 'Starting Vector') self.inputs.new('NodeSocketVector', 'End Vector') self.inputs.new('NodeSocketFloat', 'Time For Change') + self.inputs.new('NodeSocketBool', 'Stop Interpolation') self.outputs.new('NodeSocketVector', 'Vector') def register():