30 lines
590 B
Haxe
30 lines
590 B
Haxe
package armory.logicnode;
|
|
|
|
import iron.object.Object;
|
|
import iron.math.Vec4;
|
|
import armory.trait.physics.RigidBody;
|
|
|
|
class SetLocationNode 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.loc.setFrom(vec);
|
|
object.transform.buildMatrix();
|
|
|
|
#if arm_physics
|
|
var rigidBody = object.getTrait(RigidBody);
|
|
if (rigidBody != null) rigidBody.syncTransform();
|
|
#end
|
|
|
|
runOutput(0);
|
|
}
|
|
}
|