armory/Sources/armory/logicnode/VectorToObjectOrientationNode.hx

23 lines
419 B
Haxe
Raw Permalink Normal View History

2020-10-24 19:39:20 +02:00
package armory.logicnode;
import iron.object.Object;
import iron.math.Vec4;
2020-10-24 22:20:22 +02:00
class VectorToObjectOrientationNode extends LogicNode {
2020-10-24 19:39:20 +02:00
public function new(tree: LogicTree) {
super(tree);
}
override function get(from: Int): Dynamic {
var object: Object = inputs[0].get();
2020-11-01 22:17:56 +01:00
var vec: Vec4 = inputs[1].get();
2020-10-24 19:39:20 +02:00
2020-11-01 22:17:56 +01:00
if (object == null || vec == null) return null;
2020-10-24 19:39:20 +02:00
return vec.applyQuat(object.transform.rot);
2020-10-24 19:39:20 +02:00
}
2020-11-01 22:17:56 +01:00
2020-10-24 19:39:20 +02:00
}