armory/Sources/armory/logicnode/SetFrictionNode.hx

28 lines
464 B
Haxe
Raw Permalink Normal View History

package armory.logicnode;
import iron.object.Object;
import armory.trait.physics.RigidBody;
class SetFrictionNode extends LogicNode {
public function new(tree: LogicTree) {
super(tree);
}
override function run(from: Int) {
var object: Object = inputs[1].get();
2020-11-18 17:50:24 +01:00
if (object == null) return;
2020-11-18 17:50:24 +01:00
var friction = inputs[2].get();
2020-11-18 17:50:24 +01:00
#if arm_physics
var rigidBody = object.getTrait(RigidBody);
2020-11-18 17:50:24 +01:00
2020-09-07 16:00:23 +02:00
rigidBody.setFriction(friction);
2020-11-18 17:50:24 +01:00
#end
runOutput(0);
}
}