Added config for all body parts

This commit is contained in:
Eiren Rain
2021-05-23 11:57:08 +03:00
parent c5ffe0c2e8
commit b0e1c56dcc
3 changed files with 53 additions and 15 deletions

View File

@@ -34,6 +34,12 @@ public class SkeletonConfig extends EJBag {
removeAll();
int row = 0;
add(new JLabel("Chest"), c(0, row, 1));
add(new AdjButton("+", "Chest", 0.01f), c(1, row, 1));
add(new SkeletonLabel("Chest"), c(2, row, 1));
add(new AdjButton("-", "Chest", -0.01f), c(3, row, 1));
row++;
add(new JLabel("Waist"), c(0, row, 1));
add(new AdjButton("+", "Waist", 0.01f), c(1, row, 1));
@@ -46,12 +52,36 @@ public class SkeletonConfig extends EJBag {
add(new SkeletonLabel("Virtual waist"), c(2, row, 1));
add(new AdjButton("-", "Virtual waist", -0.01f), c(3, row, 1));
row++;
add(new JLabel("Head shift"), c(0, row, 1));
add(new JLabel("Hips width"), c(0, row, 1));
add(new AdjButton("+", "Hips width", 0.01f), c(1, row, 1));
add(new SkeletonLabel("Hips width"), c(2, row, 1));
add(new AdjButton("-", "Hips width", -0.01f), c(3, row, 1));
row++;
add(new JLabel("Hip length"), c(0, row, 1));
add(new AdjButton("+", "Hip length", 0.01f), c(1, row, 1));
add(new SkeletonLabel("Hip length"), c(2, row, 1));
add(new AdjButton("-", "Hip length", -0.01f), c(3, row, 1));
row++;
add(new JLabel("Ankle length"), c(0, row, 1));
add(new AdjButton("+", "Ankle length", 0.01f), c(1, row, 1));
add(new SkeletonLabel("Ankle length"), c(2, row, 1));
add(new AdjButton("-", "Ankle length", -0.01f), c(3, row, 1));
row++;
add(new JLabel("Head offset"), c(0, row, 1));
add(new AdjButton("+", "Head", 0.01f), c(1, row, 1));
add(new SkeletonLabel("Head"), c(2, row, 1));
add(new AdjButton("-", "Head", -0.01f), c(3, row, 1));
row++;
add(new JLabel("Neck length"), c(0, row, 1));
add(new AdjButton("+", "Neck", 0.01f), c(1, row, 1));
add(new SkeletonLabel("Neck"), c(2, row, 1));
add(new AdjButton("-", "Neck", -0.01f), c(3, row, 1));
row++;
gui.refresh();
});

View File

@@ -69,7 +69,7 @@ public class HumanSekeletonWithLegs extends HumanSkeleonWithWaist {
lat.setStatus(TrackerStatus.OK);
rat.setStatus(TrackerStatus.OK);
hipsWidth = server.config.getFloat("body.hipsWidth", hipsWidth);
hipsLength = server.config.getFloat("body.hipsLength", hipsLength);
hipsLength = server.config.getFloat("body.hipLength", hipsLength);
ankleLength = server.config.getFloat("body.ankleLength", ankleLength);
waistNode.attachChild(leftHipNode);
@@ -91,8 +91,8 @@ public class HumanSekeletonWithLegs extends HumanSkeleonWithWaist {
rightAnkleNode.localTransform.setTranslation(0, -ankleLength, 0);
configMap.put("Hips width", hipsWidth);
configMap.put("Hips length", hipsLength);
configMap.put("Legs length", ankleLength);
configMap.put("Hip length", hipsLength);
configMap.put("Ankle length", ankleLength);
}
@Override
@@ -105,13 +105,13 @@ public class HumanSekeletonWithLegs extends HumanSkeleonWithWaist {
leftHipNode.localTransform.setTranslation(hipsWidth / 2, 0, 0);
rightHipNode.localTransform.setTranslation(-hipsWidth / 2, 0, 0);
break;
case "Hips length":
case "Hip length":
hipsLength = newLength;
server.config.setProperty("body.hipsLength", hipsLength);
server.config.setProperty("body.hipLength", hipsLength);
leftKneeNode.localTransform.setTranslation(0, -hipsLength, 0);
rightKneeNode.localTransform.setTranslation(0, -hipsLength, 0);
break;
case "Legs length":
case "Ankle length":
ankleLength = newLength;
server.config.setProperty("body.ankleLength", ankleLength);
leftAnkleNode.localTransform.setTranslation(0, -ankleLength, 0);

View File

@@ -33,6 +33,7 @@ public class HumanSkeleonWithWaist extends HumanSkeleton {
protected final TransformNode chestNode = new TransformNode("Chest", false);
protected final TransformNode trackerWaistNode = new TransformNode("Waist-Tracker", false);
protected float chestDistance = 0.42f;
/**
* Distance from eyes to waist
*/
@@ -67,6 +68,7 @@ public class HumanSkeleonWithWaist extends HumanSkeleton {
cwt.setStatus(TrackerStatus.OK);
headShift = server.config.getFloat("body.headShift", headShift);
neckLength = server.config.getFloat("body.neckLength", neckLength);
chestDistance = server.config.getFloat("body.chestDistance", chestDistance);
waistDistance = server.config.getFloat("body.waistDistance", waistDistance);
trackerWaistDistance = server.config.getFloat("body.trackerWaistDistance", trackerWaistDistance);
// Build skeleton
@@ -77,16 +79,17 @@ public class HumanSkeleonWithWaist extends HumanSkeleton {
neckNode.localTransform.setTranslation(0, -neckLength, 0);
neckNode.attachChild(chestNode);
chestNode.localTransform.setTranslation(0, -waistDistance / 2, 0);
chestNode.localTransform.setTranslation(0, -chestDistance, 0);
chestNode.attachChild(waistNode);
waistNode.localTransform.setTranslation(0, -waistDistance / 2, 0);
waistNode.localTransform.setTranslation(0, -(waistDistance - chestDistance), 0);
chestNode.attachChild(trackerWaistNode);
trackerWaistNode.localTransform.setTranslation(0, -(trackerWaistDistance - waistDistance / 2), 0);
trackerWaistNode.localTransform.setTranslation(0, -(trackerWaistDistance - chestDistance), 0);
configMap.put("Head", headShift);
configMap.put("Neck", neckLength);
configMap.put("Chest", chestDistance);
configMap.put("Waist", waistDistance);
configMap.put("Virtual waist", trackerWaistDistance);
}
@@ -113,14 +116,19 @@ public class HumanSkeleonWithWaist extends HumanSkeleton {
case "Waist":
waistDistance = newLength;
server.config.setProperty("body.waistDistance", waistDistance);
chestNode.localTransform.setTranslation(0, -waistDistance / 2, 0);
waistNode.localTransform.setTranslation(0, -waistDistance / 2, 0);
trackerWaistNode.localTransform.setTranslation(0, -(trackerWaistDistance - waistDistance / 2), 0);
waistNode.localTransform.setTranslation(0, -(waistDistance - chestDistance), 0);
break;
case "Chest":
chestDistance = newLength;
server.config.setProperty("body.chestDistance", chestDistance);
chestNode.localTransform.setTranslation(0, -chestDistance, 0);
waistNode.localTransform.setTranslation(0, -(waistDistance - chestDistance), 0);
trackerWaistNode.localTransform.setTranslation(0, -(trackerWaistDistance - chestDistance), 0);
break;
case "Virtual waist":
trackerWaistDistance = newLength;
server.config.setProperty("body.trackerWaistDistance", trackerWaistDistance);
trackerWaistNode.localTransform.setTranslation(0, -(trackerWaistDistance - waistDistance / 2), 0);
trackerWaistNode.localTransform.setTranslation(0, -(trackerWaistDistance - chestDistance), 0);
break;
}
}