2017-04-14 20:38:50 +02:00
|
|
|
package armory.logicnode;
|
|
|
|
|
2017-11-20 15:16:52 +01:00
|
|
|
import iron.object.Object;
|
|
|
|
import iron.math.Mat4;
|
2017-04-16 14:46:35 +02:00
|
|
|
#if arm_physics
|
2017-09-30 00:32:06 +02:00
|
|
|
import armory.trait.physics.RigidBody;
|
2017-04-16 14:46:35 +02:00
|
|
|
#end
|
2017-04-14 20:38:50 +02:00
|
|
|
|
|
|
|
class AppendTransformNode extends LogicNode {
|
|
|
|
|
2019-12-19 23:54:08 +01:00
|
|
|
public function new(tree: LogicTree) {
|
2017-04-14 20:38:50 +02:00
|
|
|
super(tree);
|
|
|
|
}
|
|
|
|
|
2019-12-19 23:54:08 +01:00
|
|
|
override function run(from: Int) {
|
|
|
|
var object: Object = inputs[1].get();
|
|
|
|
var matrix: Mat4 = inputs[2].get();
|
2017-04-14 20:38:50 +02:00
|
|
|
|
2018-06-14 14:52:05 +02:00
|
|
|
if (object == null || matrix == null) return;
|
2017-04-14 20:38:50 +02:00
|
|
|
|
|
|
|
object.transform.multMatrix(matrix);
|
|
|
|
|
2017-04-16 14:46:35 +02:00
|
|
|
#if arm_physics
|
|
|
|
var rigidBody = object.getTrait(RigidBody);
|
2017-07-01 13:12:22 +02:00
|
|
|
if (rigidBody != null) rigidBody.syncTransform();
|
2017-04-16 14:46:35 +02:00
|
|
|
#end
|
|
|
|
|
2018-10-22 10:10:33 +02:00
|
|
|
runOutput(0);
|
2017-04-14 20:38:50 +02:00
|
|
|
}
|
|
|
|
}
|