armory/Sources/armory/logicnode/SetRotationNode.hx
niacdoial 1d0a6d7955
Did the haxe part of the ongoing update.
Also fixed a ton of bugs in the python part.
NOTE: this requires a yet-to-be-done commit to Iron to work.
2021-08-17 19:29:35 +02:00

35 lines
662 B
Haxe

package armory.logicnode;
import iron.object.Object;
import iron.math.Quat;
import armory.trait.physics.RigidBody;
class SetRotationNode extends LogicNode {
public var property0: String; // UNUSED
public function new(tree: LogicTree) {
super(tree);
}
override function run(from: Int) {
var object: Object = inputs[1].get();
if (object == null) return;
var q: Quat = inputs[2].get();
if (q == null) return;
q.normalize();
object.transform.rot = q;
object.transform.buildMatrix();
#if arm_physics
var rigidBody = object.getTrait(RigidBody);
if (rigidBody != null) {
rigidBody.syncTransform();
}
#end
runOutput(0);
}
}