armory/Sources/armory/logicnode/SeparateTransformNode.hx

27 lines
525 B
Haxe
Raw Normal View History

2017-04-04 23:11:31 +02:00
package armory.logicnode;
import iron.math.Mat4;
import iron.math.Vec4;
import iron.math.Quat;
2017-04-08 20:05:35 +02:00
class SeparateTransformNode extends LogicNode {
2017-04-04 23:11:31 +02:00
2019-12-19 23:54:08 +01:00
public function new(tree: LogicTree) {
2017-04-04 23:11:31 +02:00
super(tree);
}
2019-12-19 23:54:08 +01:00
override function get(from: Int): Dynamic {
var matrix: Mat4 = inputs[0].get();
2018-06-14 14:52:05 +02:00
if (matrix == null) return null;
2017-04-04 23:11:31 +02:00
var loc = new Vec4();
var rot = new Quat();
var scale = new Vec4();
matrix.decompose(loc, rot, scale);
if (from == 0) return loc;
else if (from == 1) return rot;
2017-04-04 23:11:31 +02:00
else return scale;
}
}