armory/Sources/armory/logicnode/SetScaleNode.hx
2019-12-19 23:54:08 +01:00

30 lines
593 B
Haxe

package armory.logicnode;
import iron.object.Object;
import iron.math.Vec4;
import armory.trait.physics.RigidBody;
class SetScaleNode extends LogicNode {
public function new(tree: LogicTree) {
super(tree);
}
override function run(from: Int) {
var object: Object = inputs[1].get();
var vec: Vec4 = inputs[2].get();
if (object == null || vec == null) return;
object.transform.scale.setFrom(vec);
object.transform.buildMatrix();
#if arm_physics
var rigidBody = object.getTrait(RigidBody);
if (rigidBody != null) rigidBody.syncTransform();
#end
runOutput(0);
}
}