armory/Sources/armory/logicnode/PhysicsConstraintNode.hx

42 lines
907 B
Haxe
Raw Normal View History

2020-12-05 01:03:13 +01:00
package armory.logicnode;
#if arm_physics
import armory.trait.physics.bullet.PhysicsConstraint.ConstraintAxis;
#end
class PhysicsConstraintNode extends LogicNode {
public var property0: String; //Linear or Angular
public var property1: String; //Axis
public var property2: Bool; //Is a spring
#if arm_physics
public var value1: Float; //Lower limit or Spring Stiffness
public var value2: Float; //Upper limit or Spring Damping
2020-12-05 01:03:13 +01:00
public var isAngular: Bool;
public var axis: ConstraintAxis;
public var isSpring: Bool;
#end
2020-12-05 01:03:13 +01:00
public function new(tree: LogicTree) {
super(tree);
}
override function get(from: Int): PhysicsConstraintNode {
#if arm_physics
2020-12-05 01:03:13 +01:00
value1 = inputs[0].get();
value2 = inputs[1].get();
isAngular = property0 != "Linear";
isSpring = property2;
2020-12-05 01:03:13 +01:00
switch (property1) {
case "X": axis = X;
case "Y": axis = Y;
case "Z": axis = Z;
2020-12-05 01:03:13 +01:00
}
#end
2020-12-05 01:03:13 +01:00
return this;
}
}