28 lines
464 B
Haxe
28 lines
464 B
Haxe
package leenkx.logicnode;
|
|
|
|
import iron.object.Object;
|
|
import leenkx.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();
|
|
|
|
if (object == null) return;
|
|
|
|
var friction = inputs[2].get();
|
|
|
|
#if lnx_physics
|
|
var rigidBody = object.getTrait(RigidBody);
|
|
|
|
rigidBody.setFriction(friction);
|
|
#end
|
|
|
|
runOutput(0);
|
|
}
|
|
}
|