mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-11-27 04:16:32 -08:00
Merge pull request #84 from Louka3000/main
Changed body proportions: Torso, Chest, Waist
This commit is contained in:
7 files changed
+125
-112
No files matched your search
@@ -62,7 +62,7 @@ public class AutoBone {
|
||||
|
||||
// Assume these to be approximately half
|
||||
public float kneeLegRatio = 0.5f;
|
||||
public float chestWaistRatio = 0.5f;
|
||||
public float chestHipRatio = 0.5f;
|
||||
|
||||
protected final VRServer server;
|
||||
|
||||
@@ -72,7 +72,7 @@ public class AutoBone {
|
||||
public final HashMap<String, Float> configs = new HashMap<String, Float>();
|
||||
public final HashMap<String, Float> staticConfigs = new HashMap<String, Float>();
|
||||
|
||||
public final FastList<String> heightConfigs = new FastList<String>(new String[]{"Neck", "Waist", "Hip", "Legs length"});
|
||||
public final FastList<String> heightConfigs = new FastList<String>(new String[]{"Neck", "Torso", "Legs length"});
|
||||
|
||||
public AutoBone(VRServer server) {
|
||||
this.server = server;
|
||||
@@ -87,10 +87,10 @@ public class AutoBone {
|
||||
}
|
||||
|
||||
public void reloadConfigValues(TrackerFrame[] frame) {
|
||||
// Load waist configs
|
||||
// Load torso configs
|
||||
staticConfigs.put("Head", server.config.getFloat("body.headShift", HumanSkeletonWithWaist.HEAD_SHIFT_DEFAULT));
|
||||
staticConfigs.put("Neck", server.config.getFloat("body.neckLength", HumanSkeletonWithWaist.NECK_LENGTH_DEFAULT));
|
||||
configs.put("Waist", server.config.getFloat("body.waistDistance", 0.6f));
|
||||
configs.put("Torso", server.config.getFloat("body.torsoLength", 0.7f));
|
||||
if(server.config.getBoolean("autobone.forceChestTracker", false) || (frame != null && TrackerUtils.findTrackerForBodyPosition(frame, TrackerPosition.CHEST) != null) || TrackerUtils.findTrackerForBodyPosition(server.getAllTrackers(), TrackerPosition.CHEST) != null) {
|
||||
// If force enabled or has a chest tracker
|
||||
configs.put("Chest", server.config.getFloat("body.chestDistance", 0.35f));
|
||||
@@ -101,11 +101,11 @@ public class AutoBone {
|
||||
}
|
||||
if(server.config.getBoolean("autobone.forceHipTracker", false) || (frame != null && TrackerUtils.findTrackerForBodyPosition(frame, TrackerPosition.HIP) != null) || TrackerUtils.findTrackerForBodyPosition(server.getAllTrackers(), TrackerPosition.HIP) != null) {
|
||||
// If force enabled or has a hip tracker
|
||||
configs.put("Hip", server.config.getFloat("body.hipDistance", 0.1f));
|
||||
configs.put("Waist", server.config.getFloat("body.waistDistance", 0.1f));
|
||||
} else {
|
||||
// Otherwise, make sure it's not used
|
||||
configs.remove("Hip");
|
||||
staticConfigs.put("Hip", server.config.getFloat("body.hipDistance", 0.1f));
|
||||
configs.remove("Waist");
|
||||
staticConfigs.put("Waist", server.config.getFloat("body.waistDistance", 0.1f));
|
||||
}
|
||||
|
||||
// Load leg configs
|
||||
@@ -156,7 +156,7 @@ public class AutoBone {
|
||||
setConfig("Neck", "body.neckLength");
|
||||
setConfig("Waist", "body.waistDistance");
|
||||
setConfig("Chest", "body.chestDistance");
|
||||
setConfig("Hip", "body.hipDistance");
|
||||
setConfig("Torso", "body.torsoLength");
|
||||
setConfig("Hips width", "body.hipsWidth");
|
||||
setConfig("Legs length", "body.legsLength");
|
||||
setConfig("Knee height", "body.kneeHeight");
|
||||
@@ -400,12 +400,12 @@ public class AutoBone {
|
||||
protected float getProportionErrorDeriv(SimpleSkeleton skeleton) {
|
||||
Float neckLength = skeleton.getSkeletonConfig("Neck");
|
||||
Float chestLength = skeleton.getSkeletonConfig("Chest");
|
||||
Float waistLength = skeleton.getSkeletonConfig("Waist");
|
||||
Float torsoLength = skeleton.getSkeletonConfig("Torso");
|
||||
Float legsLength = skeleton.getSkeletonConfig("Legs length");
|
||||
Float kneeHeight = skeleton.getSkeletonConfig("Knee height");
|
||||
|
||||
float chestWaist = chestLength != null && waistLength != null ? Math.abs((chestLength / waistLength) - chestWaistRatio) : 0f;
|
||||
float legBody = legsLength != null && waistLength != null && neckLength != null ? Math.abs((legsLength / (waistLength + neckLength)) - legBodyRatio) : 0f;
|
||||
float chestHip = chestLength != null && torsoLength != null ? Math.abs((chestLength / torsoLength) - chestHipRatio) : 0f;
|
||||
float legBody = legsLength != null && torsoLength != null && neckLength != null ? Math.abs((legsLength / (torsoLength + neckLength)) - legBodyRatio) : 0f;
|
||||
float kneeLeg = kneeHeight != null && legsLength != null ? Math.abs((kneeHeight / legsLength) - kneeLegRatio) : 0f;
|
||||
|
||||
if(legBody <= legBodyRatioRange) {
|
||||
@@ -414,7 +414,7 @@ public class AutoBone {
|
||||
legBody -= legBodyRatioRange;
|
||||
}
|
||||
|
||||
return (chestWaist + legBody + kneeLeg) / 3f;
|
||||
return (chestHip + legBody + kneeLeg) / 3f;
|
||||
}
|
||||
|
||||
// The distance of any points to the corresponding absolute position
|
||||
|
||||
@@ -25,15 +25,18 @@ public class SimpleSkeleton {
|
||||
protected final TransformNode chestNode = new TransformNode("Chest", false);
|
||||
protected final TransformNode hipNode = new TransformNode("Hip", false);
|
||||
|
||||
/**
|
||||
* Distance from shoulders to chest
|
||||
*/
|
||||
protected float chestDistance = 0.35f;
|
||||
/**
|
||||
* Distance from eyes to waist
|
||||
* Distance from hip to waist
|
||||
*/
|
||||
protected float waistDistance = 0.6f;
|
||||
protected float waistDistance = 0.1f;
|
||||
/**
|
||||
* Distance from waist to hip
|
||||
* Distance from shoulder to hip
|
||||
*/
|
||||
protected float hipDistance = 0.1f;
|
||||
protected float torsoLength = 0.7f;
|
||||
/**
|
||||
* Distance from eyes to the base of the neck
|
||||
*/
|
||||
@@ -81,10 +84,10 @@ public class SimpleSkeleton {
|
||||
chestNode.localTransform.setTranslation(0, -chestDistance, 0);
|
||||
|
||||
chestNode.attachChild(waistNode);
|
||||
waistNode.localTransform.setTranslation(0, -(waistDistance - chestDistance), 0);
|
||||
waistNode.localTransform.setTranslation(0, (chestDistance - torsoLength + waistDistance), 0);
|
||||
|
||||
waistNode.attachChild(hipNode);
|
||||
hipNode.localTransform.setTranslation(0, -hipDistance, 0);
|
||||
hipNode.localTransform.setTranslation(0, -waistDistance, 0);
|
||||
|
||||
// Assemble skeleton to feet
|
||||
hipNode.attachChild(leftHipNode);
|
||||
@@ -222,26 +225,27 @@ public class SimpleSkeleton {
|
||||
neckNode.update();
|
||||
}
|
||||
break;
|
||||
case "Waist":
|
||||
waistDistance = newLength;
|
||||
waistNode.localTransform.setTranslation(0, -(waistDistance - chestDistance), 0);
|
||||
case "Torso":
|
||||
torsoLength = newLength;
|
||||
waistNode.localTransform.setTranslation(0, (chestDistance - torsoLength + waistDistance), 0);
|
||||
if(updatePose) {
|
||||
waistNode.update();
|
||||
hipNode.update();
|
||||
}
|
||||
break;
|
||||
case "Chest":
|
||||
chestDistance = newLength;
|
||||
chestNode.localTransform.setTranslation(0, -chestDistance, 0);
|
||||
waistNode.localTransform.setTranslation(0, -(waistDistance - chestDistance), 0);
|
||||
waistNode.localTransform.setTranslation(0, (chestDistance - torsoLength + waistDistance), 0);
|
||||
if(updatePose) {
|
||||
chestNode.update();
|
||||
}
|
||||
break;
|
||||
case "Hip":
|
||||
hipDistance = newLength;
|
||||
hipNode.localTransform.setTranslation(0, -hipDistance, 0);
|
||||
case "Waist":
|
||||
waistDistance = newLength;
|
||||
waistNode.localTransform.setTranslation(0, (chestDistance - torsoLength + waistDistance), 0);
|
||||
hipNode.localTransform.setTranslation(0, -waistDistance, 0);
|
||||
if(updatePose) {
|
||||
hipNode.update();
|
||||
waistNode.update();
|
||||
}
|
||||
break;
|
||||
case "Hips width":
|
||||
@@ -282,12 +286,12 @@ public class SimpleSkeleton {
|
||||
return headShift;
|
||||
case "Neck":
|
||||
return neckLength;
|
||||
case "Torso":
|
||||
return torsoLength;
|
||||
case "Waist":
|
||||
return waistDistance;
|
||||
case "Chest":
|
||||
return chestDistance;
|
||||
case "Hip":
|
||||
return hipDistance;
|
||||
case "Hips width":
|
||||
return hipsWidth;
|
||||
case "Knee height":
|
||||
@@ -324,7 +328,7 @@ public class SimpleSkeleton {
|
||||
case WAIST:
|
||||
return rotationNode ? chestNode : waistNode;
|
||||
case HIP:
|
||||
return rotationNode ? hipNode : waistNode; //TODO check, need 3?
|
||||
return rotationNode ? waistNode : hipNode;
|
||||
|
||||
case LEFT_LEG:
|
||||
return rotationNode ? leftHipNode : leftKneeNode;
|
||||
@@ -360,7 +364,7 @@ public class SimpleSkeleton {
|
||||
config.setProperty("body.neckLength", neckLength);
|
||||
config.setProperty("body.waistDistance", waistDistance);
|
||||
config.setProperty("body.chestDistance", chestDistance);
|
||||
config.setProperty("body.hipDistance", hipDistance);
|
||||
config.setProperty("body.torsoLength", torsoLength);
|
||||
|
||||
// Save leg configs
|
||||
config.setProperty("body.hipsWidth", hipsWidth);
|
||||
|
||||
@@ -4632,7 +4632,7 @@ public final class ProtobufMessages {
|
||||
}
|
||||
private com.google.protobuf.MapField<java.lang.String, java.lang.String>
|
||||
internalGetMutableExtra() {
|
||||
onChanged();;
|
||||
onChanged();
|
||||
if (extra_ == null) {
|
||||
extra_ = com.google.protobuf.MapField.newMapField(
|
||||
ExtraDefaultEntryHolder.defaultEntry);
|
||||
@@ -5099,7 +5099,7 @@ public final class ProtobufMessages {
|
||||
public int getNumber() {
|
||||
return this.value;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessageCase
|
||||
@@ -5791,7 +5791,7 @@ public final class ProtobufMessages {
|
||||
message_ = null;
|
||||
}
|
||||
messageCase_ = 1;
|
||||
onChanged();;
|
||||
onChanged();
|
||||
return positionBuilder_;
|
||||
}
|
||||
|
||||
@@ -5932,7 +5932,7 @@ public final class ProtobufMessages {
|
||||
message_ = null;
|
||||
}
|
||||
messageCase_ = 2;
|
||||
onChanged();;
|
||||
onChanged();
|
||||
return userActionBuilder_;
|
||||
}
|
||||
|
||||
@@ -6073,7 +6073,7 @@ public final class ProtobufMessages {
|
||||
message_ = null;
|
||||
}
|
||||
messageCase_ = 3;
|
||||
onChanged();;
|
||||
onChanged();
|
||||
return trackerAddedBuilder_;
|
||||
}
|
||||
|
||||
@@ -6214,7 +6214,7 @@ public final class ProtobufMessages {
|
||||
message_ = null;
|
||||
}
|
||||
messageCase_ = 4;
|
||||
onChanged();;
|
||||
onChanged();
|
||||
return trackerStatusBuilder_;
|
||||
}
|
||||
@java.lang.Override
|
||||
|
||||
@@ -340,21 +340,20 @@ public class AutoBoneWindow extends JFrame {
|
||||
|
||||
//#region Stats/Values
|
||||
Float neckLength = autoBone.getConfig("Neck");
|
||||
Float chestLength = autoBone.getConfig("Chest");
|
||||
Float waistLength = autoBone.getConfig("Waist");
|
||||
Float hipLength = autoBone.getConfig("Hip");
|
||||
Float chestDistance = autoBone.getConfig("Chest");
|
||||
Float torsoLength = autoBone.getConfig("Torso");
|
||||
Float hipWidth = autoBone.getConfig("Hips width");
|
||||
Float legsLength = autoBone.getConfig("Legs length");
|
||||
Float kneeHeight = autoBone.getConfig("Knee height");
|
||||
|
||||
float neckWaist = neckLength != null && waistLength != null ? neckLength / waistLength : 0f;
|
||||
float chestWaist = chestLength != null && waistLength != null ? chestLength / waistLength : 0f;
|
||||
float hipWaist = hipWidth != null && waistLength != null ? hipWidth / waistLength : 0f;
|
||||
float legWaist = legsLength != null && waistLength != null ? legsLength / waistLength : 0f;
|
||||
float legBody = legsLength != null && waistLength != null && neckLength != null ? legsLength / (waistLength + neckLength) : 0f;
|
||||
float neckHip = neckLength != null && torsoLength != null ? neckLength / torsoLength : 0f;
|
||||
float chestHip = chestDistance != null && torsoLength != null ? chestDistance / torsoLength : 0f;
|
||||
float hipWaist = hipWidth != null && torsoLength != null ? hipWidth / torsoLength : 0f;
|
||||
float legWaist = legsLength != null && torsoLength != null ? legsLength / torsoLength : 0f;
|
||||
float legBody = legsLength != null && torsoLength != null && neckLength != null ? legsLength / (torsoLength + neckLength) : 0f;
|
||||
float kneeLeg = kneeHeight != null && legsLength != null ? kneeHeight / legsLength : 0f;
|
||||
|
||||
LogManager.log.info("[AutoBone] Ratios: [{Neck-Waist: " + StringUtils.prettyNumber(neckWaist) + "}, {Chest-Waist: " + StringUtils.prettyNumber(chestWaist) + "}, {Hip-Waist: " + StringUtils.prettyNumber(hipWaist) + "}, {Leg-Waist: " + StringUtils.prettyNumber(legWaist) + "}, {Leg-Body: " + StringUtils.prettyNumber(legBody) + "}, {Knee-Leg: " + StringUtils.prettyNumber(kneeLeg) + "}]");
|
||||
LogManager.log.info("[AutoBone] Ratios: [{Neck-Hip: " + StringUtils.prettyNumber(neckHip) + "}, {Chest-Hip: " + StringUtils.prettyNumber(chestHip) + "}, {Hip-Waist: " + StringUtils.prettyNumber(hipWaist) + "}, {Leg-Hip: " + StringUtils.prettyNumber(legWaist) + "}, {Leg-Body: " + StringUtils.prettyNumber(legBody) + "}, {Knee-Leg: " + StringUtils.prettyNumber(kneeLeg) + "}]");
|
||||
|
||||
String lengthsString = getLengthsString();
|
||||
LogManager.log.info("[AutoBone] Length values: " + lengthsString);
|
||||
|
||||
@@ -103,25 +103,25 @@ public class SkeletonConfig extends EJBagNoStretch {
|
||||
}}, s(c(4, row, 2), 3, 1));
|
||||
row++;
|
||||
|
||||
add(new JLabel("Chest"), c(0, row, 2));
|
||||
add(new JLabel("Torso length"), c(0, row, 2));
|
||||
add(new AdjButton("+", "Torso", 0.01f), c(1, row, 2));
|
||||
add(new SkeletonLabel("Torso"), c(2, row, 2));
|
||||
add(new AdjButton("-", "Torso", -0.01f), c(3, row, 2));
|
||||
add(new TimedResetButton("Reset", "Torso"), c(4, row, 2));
|
||||
row++;
|
||||
|
||||
add(new JLabel("Chest distance"), c(0, row, 2));
|
||||
add(new AdjButton("+", "Chest", 0.01f), c(1, row, 2));
|
||||
add(new SkeletonLabel("Chest"), c(2, row, 2));
|
||||
add(new AdjButton("-", "Chest", -0.01f), c(3, row, 2));
|
||||
add(new ResetButton("Reset", "Chest"), c(4, row, 2));
|
||||
row++;
|
||||
|
||||
add(new JLabel("Waist"), c(0, row, 2));
|
||||
add(new JLabel("Waist distance"), c(0, row, 2));
|
||||
add(new AdjButton("+", "Waist", 0.01f), c(1, row, 2));
|
||||
add(new SkeletonLabel("Waist"), c(2, row, 2));
|
||||
add(new AdjButton("-", "Waist", -0.01f), c(3, row, 2));
|
||||
add(new TimedResetButton("Reset", "Waist"), c(4, row, 2));
|
||||
row++;
|
||||
|
||||
add(new JLabel("Hip"), c(0, row, 2));
|
||||
add(new AdjButton("+", "Hip", 0.01f), c(1, row, 2));
|
||||
add(new SkeletonLabel("Hip"), c(2, row, 2));
|
||||
add(new AdjButton("-", "Hip", -0.01f), c(3, row, 2));
|
||||
add(new ResetButton("Reset", "Hip"), c(4, row, 2));
|
||||
add(new ResetButton("Reset", "Waist"), c(4, row, 2));
|
||||
row++;
|
||||
|
||||
add(new JLabel("Hips width"), c(0, row, 2));
|
||||
@@ -142,7 +142,7 @@ public class SkeletonConfig extends EJBagNoStretch {
|
||||
add(new AdjButton("+", "Knee height", 0.01f), c(1, row, 2));
|
||||
add(new SkeletonLabel("Knee height"), c(2, row, 2));
|
||||
add(new AdjButton("-", "Knee height", -0.01f), c(3, row, 2));
|
||||
add(new TimedResetButton("Reset", "Knee height"), c(4, row, 2));
|
||||
add(new ResetButton("Reset", "Knee height"), c(4, row, 2));
|
||||
row++;
|
||||
|
||||
add(new JLabel("Foot length"), c(0, row, 2));
|
||||
@@ -152,13 +152,6 @@ public class SkeletonConfig extends EJBagNoStretch {
|
||||
add(new ResetButton("Reset", "Foot length"), c(4, row, 2));
|
||||
row++;
|
||||
|
||||
add(new JLabel("Foot offset"), c(0, row, 2));
|
||||
add(new AdjButton("+", "Foot offset", 0.01f), c(1, row, 2));
|
||||
add(new SkeletonLabel("Foot offset"), c(2, row, 2));
|
||||
add(new AdjButton("-", "Foot offset", -0.01f), c(3, row, 2));
|
||||
add(new ResetButton("Reset", "Foot offset"), c(4, row, 2));
|
||||
row++;
|
||||
|
||||
add(new JLabel("Head offset"), c(0, row, 2));
|
||||
add(new AdjButton("+", "Head", 0.01f), c(1, row, 2));
|
||||
add(new SkeletonLabel("Head"), c(2, row, 2));
|
||||
@@ -173,11 +166,18 @@ public class SkeletonConfig extends EJBagNoStretch {
|
||||
add(new ResetButton("Reset", "Neck"), c(4, row, 2));
|
||||
row++;
|
||||
|
||||
add(new JLabel("Virtual waist"), c(0, row, 2));
|
||||
add(new AdjButton("+", "Virtual waist", 0.01f), c(1, row, 2));
|
||||
add(new SkeletonLabel("Virtual waist"), c(2, row, 2));
|
||||
add(new AdjButton("-", "Virtual waist", -0.01f), c(3, row, 2));
|
||||
add(new ResetButton("Reset", "Virtual waist"), c(4, row, 2));
|
||||
add(new JLabel("Hip offset"), c(0, row, 2));
|
||||
add(new AdjButton("+", "Hip offset", 0.01f), c(1, row, 2));
|
||||
add(new SkeletonLabel("Hip offset"), c(2, row, 2));
|
||||
add(new AdjButton("-", "Hip offset", -0.01f), c(3, row, 2));
|
||||
add(new ResetButton("Reset", "Hip offset"), c(4, row, 2));
|
||||
row++;
|
||||
|
||||
add(new JLabel("Foot offset"), c(0, row, 2));
|
||||
add(new AdjButton("+", "Foot offset", 0.01f), c(1, row, 2));
|
||||
add(new SkeletonLabel("Foot offset"), c(2, row, 2));
|
||||
add(new AdjButton("-", "Foot offset", -0.01f), c(3, row, 2));
|
||||
add(new ResetButton("Reset", "Foot offset"), c(4, row, 2));
|
||||
row++;
|
||||
|
||||
gui.refresh();
|
||||
|
||||
@@ -167,7 +167,11 @@ public class HumanSkeletonWithLegs extends HumanSkeletonWithWaist {
|
||||
hmdTracker.getPosition(vec);
|
||||
float height = vec.y;
|
||||
if(height > 0.5f) { // Reset only if floor level is right, todo: read floor level from SteamVR if it's not 0
|
||||
setSkeletonConfig(joint, height - neckLength - waistDistance - hipDistance - DEFAULT_FLOOR_OFFSET);
|
||||
setSkeletonConfig(joint, height - neckLength - torsoLength - DEFAULT_FLOOR_OFFSET);
|
||||
}
|
||||
else //if floor level is incorrect
|
||||
{
|
||||
setSkeletonConfig(joint, 0.84f);
|
||||
}
|
||||
resetSkeletonConfig("Knee height");
|
||||
break;
|
||||
|
||||
@@ -41,21 +41,24 @@ public class HumanSkeletonWithWaist extends HumanSkeleton {
|
||||
protected final TransformNode trackerWaistNode = new TransformNode("Waist-Tracker", false);
|
||||
protected final TransformNode hipNode = new TransformNode("Hip", false);
|
||||
|
||||
/**
|
||||
* Distance from shoulders to chest
|
||||
*/
|
||||
protected float chestDistance = 0.35f;
|
||||
/**
|
||||
* Distance from eyes to waist
|
||||
* Distance from hip to waist
|
||||
*/
|
||||
protected float waistDistance = 0.6f;
|
||||
protected float waistDistance = 0.1f;
|
||||
/**
|
||||
* Distance from waist to hip
|
||||
* Distance from shoulder to hip
|
||||
*/
|
||||
protected float hipDistance = 0.1f;
|
||||
protected float torsoLength = 0.7f;
|
||||
/**
|
||||
* Distance from eyes to waist, defines reported
|
||||
* Distance from eyes to hip, defines reported
|
||||
* tracker position, if you want to move resulting
|
||||
* tracker up or down from actual waist
|
||||
* tracker up or down from actual hip
|
||||
*/
|
||||
protected float trackerWaistDistance = 0.0f;
|
||||
protected float hipOffset = 0.0f;
|
||||
/**
|
||||
* Distance from eyes to the base of the neck
|
||||
*/
|
||||
@@ -88,8 +91,8 @@ public class HumanSkeletonWithWaist extends HumanSkeleton {
|
||||
neckLength = server.config.getFloat("body.neckLength", neckLength);
|
||||
chestDistance = server.config.getFloat("body.chestDistance", chestDistance);
|
||||
waistDistance = server.config.getFloat("body.waistDistance", waistDistance);
|
||||
hipDistance = server.config.getFloat("body.hipDistance", hipDistance);
|
||||
trackerWaistDistance = server.config.getFloat("body.trackerWaistDistance", trackerWaistDistance);
|
||||
torsoLength = server.config.getFloat("body.torsoLength", torsoLength);
|
||||
hipOffset = server.config.getFloat("body.hipOffset", hipOffset);
|
||||
// Build skeleton
|
||||
hmdNode.attachChild(headNode);
|
||||
headNode.localTransform.setTranslation(0, 0, headShift);
|
||||
@@ -101,20 +104,20 @@ public class HumanSkeletonWithWaist extends HumanSkeleton {
|
||||
chestNode.localTransform.setTranslation(0, -chestDistance, 0);
|
||||
|
||||
chestNode.attachChild(waistNode);
|
||||
waistNode.localTransform.setTranslation(0, -(waistDistance - chestDistance), 0);
|
||||
waistNode.localTransform.setTranslation(0, (chestDistance - torsoLength + waistDistance), 0);
|
||||
|
||||
waistNode.attachChild(hipNode);
|
||||
hipNode.localTransform.setTranslation(0, -hipDistance, 0);
|
||||
hipNode.localTransform.setTranslation(0, -waistDistance, 0);
|
||||
|
||||
hipNode.attachChild(trackerWaistNode);
|
||||
trackerWaistNode.localTransform.setTranslation(0, trackerWaistDistance, 0);
|
||||
trackerWaistNode.localTransform.setTranslation(0, hipOffset, 0);
|
||||
|
||||
configMap.put("Head", headShift);
|
||||
configMap.put("Neck", neckLength);
|
||||
configMap.put("Chest", chestDistance);
|
||||
configMap.put("Waist", waistDistance);
|
||||
configMap.put("Virtual waist", trackerWaistDistance);
|
||||
configMap.put("Hip", hipDistance);
|
||||
configMap.put("Hip offset", hipOffset);
|
||||
configMap.put("Torso", torsoLength);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -123,8 +126,8 @@ public class HumanSkeletonWithWaist extends HumanSkeleton {
|
||||
case "All": // Reset all joints according to height
|
||||
resetSkeletonConfig("Head");
|
||||
resetSkeletonConfig("Neck");
|
||||
resetSkeletonConfig("Virtual waist");
|
||||
resetSkeletonConfig("Hip");
|
||||
resetSkeletonConfig("Hip offset");
|
||||
resetSkeletonConfig("Torso");
|
||||
resetSkeletonConfig("Waist");
|
||||
resetSkeletonConfig("Chest");
|
||||
break;
|
||||
@@ -134,22 +137,26 @@ public class HumanSkeletonWithWaist extends HumanSkeleton {
|
||||
case "Neck":
|
||||
setSkeletonConfig(joint, NECK_LENGTH_DEFAULT);
|
||||
break;
|
||||
case "Virtual waist":
|
||||
setSkeletonConfig(joint, 0.0f);
|
||||
break;
|
||||
case "Chest": //Chest is half of the upper body (half of the waist with the hip)
|
||||
setSkeletonConfig(joint, (waistDistance + hipDistance) / 2.0f);
|
||||
break;
|
||||
case "Hip": // Distance between waist and hip
|
||||
setSkeletonConfig(joint, 0.1f);
|
||||
break;
|
||||
case "Waist": // waist length is from shoulders (bottom of neck) to waist (right above the hip)
|
||||
case "Torso": // Distance from shoulders to hip (full torso length)
|
||||
Vector3f vec = new Vector3f();
|
||||
hmdTracker.getPosition(vec);
|
||||
float height = vec.y;
|
||||
if(height > 0.5f) { // Reset only if floor level is right, TODO: read floor level from SteamVR if it's not 0
|
||||
setSkeletonConfig(joint, ((height) / 2.0f) - hipDistance - neckLength);
|
||||
setSkeletonConfig(joint, ((height) / 2.0f) - neckLength);
|
||||
}
|
||||
else// if floor level is incorrect
|
||||
{
|
||||
setSkeletonConfig(joint, 0.7f);
|
||||
}
|
||||
break;
|
||||
case "Chest": //Chest is roughly half of the upper body (shoulders to chest)
|
||||
setSkeletonConfig(joint, torsoLength / 2.0f);
|
||||
break;
|
||||
case "Waist": // waist length is from hips to waist
|
||||
setSkeletonConfig(joint, 0.1f);
|
||||
break;
|
||||
case "Hip offset":
|
||||
setSkeletonConfig(joint, 0.0f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -173,28 +180,27 @@ public class HumanSkeletonWithWaist extends HumanSkeleton {
|
||||
server.config.setProperty("body.neckLength", neckLength);
|
||||
neckNode.localTransform.setTranslation(0, -neckLength, 0);
|
||||
break;
|
||||
case "Waist":
|
||||
waistDistance = newLength;
|
||||
server.config.setProperty("body.waistDistance", waistDistance);
|
||||
waistNode.localTransform.setTranslation(0, -(waistDistance - chestDistance), 0);
|
||||
case "Torso":
|
||||
torsoLength = newLength;
|
||||
server.config.setProperty("body.torsoLength", torsoLength);
|
||||
waistNode.localTransform.setTranslation(0, (chestDistance - torsoLength + waistDistance), 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, 0);
|
||||
waistNode.localTransform.setTranslation(0, (chestDistance - torsoLength + waistDistance), 0);
|
||||
break;
|
||||
case "Hip":
|
||||
hipDistance = newLength;
|
||||
server.config.setProperty("body.hipDistance", hipDistance);
|
||||
hipNode.localTransform.setTranslation(0, -hipDistance, 0);
|
||||
trackerWaistNode.localTransform.setTranslation(0, trackerWaistDistance, 0);
|
||||
case "Waist":
|
||||
waistDistance = newLength;
|
||||
server.config.setProperty("body.waistDistance", waistDistance);
|
||||
waistNode.localTransform.setTranslation(0, (chestDistance - torsoLength + waistDistance), 0);
|
||||
hipNode.localTransform.setTranslation(0, -waistDistance, 0);
|
||||
break;
|
||||
case "Virtual waist":
|
||||
trackerWaistDistance = newLength;
|
||||
server.config.setProperty("body.trackerWaistDistance", trackerWaistDistance);
|
||||
trackerWaistNode.localTransform.setTranslation(0, trackerWaistDistance, 0);
|
||||
case "Hip offset":
|
||||
hipOffset = newLength;
|
||||
server.config.setProperty("body.hipOffset", hipOffset);
|
||||
trackerWaistNode.localTransform.setTranslation(0, hipOffset, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user