This repository has been archived by the owner on Jan 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
547976a
commit c1e104e
Showing
2 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package armory.logicnode; | ||
|
||
import iron.math.Vec4; | ||
|
||
class LerpVectorsNode extends LogicNode { | ||
|
||
var v = new Vec4(); | ||
var v1:Vec4; | ||
var v2:Vec4; | ||
var t=0.0; | ||
var c:Float; | ||
var f=0.0; | ||
|
||
public function new(tree:LogicTree) { | ||
super(tree); | ||
} | ||
|
||
override function run() { | ||
v1 = inputs[1].get(); | ||
v2 = inputs[2].get(); | ||
t = inputs[3].get(); | ||
f = (t / iron.system.Time.delta); | ||
} | ||
|
||
override function get(from:Int):Dynamic { | ||
if (v1==null) { | ||
return null; | ||
c=1; | ||
} | ||
if (t>=0) { | ||
trace(t); | ||
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; | ||
t -= iron.system.Time.delta; | ||
c++; | ||
return v; | ||
} | ||
else {c=1; return null;} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters