armory/Sources/armory/logicnode/TransformNode.hx

27 lines
509 B
Haxe
Raw Normal View History

2016-08-22 21:56:28 +02:00
package armory.logicnode;
2015-11-26 15:36:17 +01:00
2016-07-10 00:51:39 +02:00
import iron.math.Mat4;
import iron.math.Vec4;
import iron.math.Quat;
2016-08-25 00:26:01 +02:00
import iron.object.Transform;
2015-11-26 15:36:17 +01:00
class TransformNode extends Node {
2017-03-06 02:29:03 +01:00
var value:Mat4 = Mat4.identity();
static var q:Quat = new Quat();
2015-11-26 15:36:17 +01:00
2017-03-06 02:29:03 +01:00
public function new(trait:armory.Trait) {
super(trait);
2015-11-26 15:36:17 +01:00
}
2017-03-06 02:29:03 +01:00
override function get():Dynamic {
2015-11-26 15:36:17 +01:00
2017-03-06 02:29:03 +01:00
var loc = inputs[0].get();
var rot = inputs[1].get();
q.fromEuler(rot.x, rot.y, rot.z);
var scale = inputs[2].get();
value.compose(loc, q, scale);
return value;
2015-11-26 15:36:17 +01:00
}
}