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 {
|
|
|
|
|
2021-07-03 19:45:05 +02:00
|
|
|
public var property0: String; //Linear or Angular
|
|
|
|
public var property1: String; //Axis
|
|
|
|
public var property2: Bool; //Is a spring
|
2021-07-25 18:36:36 +02:00
|
|
|
|
|
|
|
#if arm_physics
|
2021-07-03 19:45:05 +02:00
|
|
|
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;
|
2021-07-25 18:36:36 +02:00
|
|
|
#end
|
2020-12-05 01:03:13 +01:00
|
|
|
|
|
|
|
public function new(tree: LogicTree) {
|
|
|
|
super(tree);
|
|
|
|
}
|
|
|
|
|
|
|
|
override function get(from: Int): PhysicsConstraintNode {
|
2021-07-25 18:36:36 +02:00
|
|
|
#if arm_physics
|
2020-12-05 01:03:13 +01:00
|
|
|
value1 = inputs[0].get();
|
|
|
|
value2 = inputs[1].get();
|
|
|
|
|
2021-07-03 19:45:05 +02:00
|
|
|
isAngular = property0 != "Linear";
|
|
|
|
isSpring = property2;
|
2020-12-05 01:03:13 +01:00
|
|
|
|
2021-07-25 18:36:36 +02:00
|
|
|
switch (property1) {
|
2021-07-03 19:45:05 +02:00
|
|
|
case "X": axis = X;
|
|
|
|
case "Y": axis = Y;
|
|
|
|
case "Z": axis = Z;
|
2020-12-05 01:03:13 +01:00
|
|
|
}
|
2021-07-25 18:36:36 +02:00
|
|
|
#end
|
2020-12-05 01:03:13 +01:00
|
|
|
return this;
|
|
|
|
}
|
|
|
|
}
|