autobone hip-only doesn't affect waist distance anymore

- Now autobone checks if user has BOTH waist and hip tracker to add the waist distance value.
- Also renamed certain variable, replacing "hip" by "torso"
This commit is contained in:
Louka committed 2021-11-29 20:08:08 -05:00
1 parent eedfa61d74
commit baccb556e8
5 files changed
+18 -18

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 chestHipRatio = 0.5f;
public float chestTorsoRatio = 0.5f;
protected final VRServer server;
@@ -99,8 +99,8 @@ public class AutoBone {
configs.remove("Chest");
staticConfigs.put("Chest", server.config.getFloat("body.chestDistance", 0.35f));
}
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
if(server.config.getBoolean("autobone.forceHipTracker", false) || (frame != null && TrackerUtils.findTrackerForBodyPosition(frame, TrackerPosition.HIP) != null && TrackerUtils.findTrackerForBodyPosition(frame, TrackerPosition.WAIST) != null) || (TrackerUtils.findTrackerForBodyPosition(server.getAllTrackers(), TrackerPosition.HIP) != null && TrackerUtils.findTrackerForBodyPosition(server.getAllTrackers(), TrackerPosition.WAIST) != null)) {
// If force enabled or has a hip tracker and waist tracker
configs.put("Waist", server.config.getFloat("body.waistDistance", 0.1f));
} else {
// Otherwise, make sure it's not used
@@ -404,7 +404,7 @@ public class AutoBone {
Float legsLength = skeleton.getSkeletonConfig("Legs length");
Float kneeHeight = skeleton.getSkeletonConfig("Knee height");
float chestHip = chestLength != null && torsoLength != null ? Math.abs((chestLength / torsoLength) - chestHipRatio) : 0f;
float chestTorso = chestLength != null && torsoLength != null ? Math.abs((chestLength / torsoLength) - chestTorsoRatio) : 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;
@@ -414,7 +414,7 @@ public class AutoBone {
legBody -= legBodyRatioRange;
}
return (chestHip + legBody + kneeLeg) / 3f;
return (chestTorso + legBody + kneeLeg) / 3f;
}
// The distance of any points to the corresponding absolute position
@@ -17,7 +17,7 @@ import io.eiren.yaml.YamlFile;
public class SimpleSkeleton {
// Waist
// Upper body (torso)
protected final TransformNode hmdNode = new TransformNode("HMD", false);
protected final TransformNode headNode = new TransformNode("Head", false);
protected final TransformNode neckNode = new TransformNode("Neck", false);
@@ -46,7 +46,7 @@ public class SimpleSkeleton {
*/
protected float headShift = HumanSkeletonWithWaist.HEAD_SHIFT_DEFAULT;
// Legs
// Lower body (legs)
protected final TransformNode leftHipNode = new TransformNode("Left-Hip", false);
protected final TransformNode leftKneeNode = new TransformNode("Left-Knee", false);
protected final TransformNode leftAnkleNode = new TransformNode("Left-Ankle", false);
@@ -59,11 +59,11 @@ public class SimpleSkeleton {
*/
protected float hipsWidth = HumanSkeletonWithLegs.HIPS_WIDTH_DEFAULT;
/**
* Length from waist to knees
* Length from hip to knees
*/
protected float kneeHeight = 0.42f;
/**
* Distance from waist to ankle
* Distance from hip to ankle
*/
protected float legsLength = 0.84f;
@@ -73,7 +73,7 @@ public class SimpleSkeleton {
private Quaternion rotBuf2 = new Quaternion();
public SimpleSkeleton() {
// Assemble skeleton to waist
// Assemble skeleton to hip
hmdNode.attachChild(headNode);
headNode.localTransform.setTranslation(0, 0, headShift);
@@ -2506,7 +2506,7 @@ public final class ProtobufMessages {
}
private com.google.protobuf.MapField<java.lang.String, java.lang.String>
internalGetMutableActionArguments() {
onChanged();;
onChanged();
if (actionArguments_ == null) {
actionArguments_ = com.google.protobuf.MapField.newMapField(
ActionArgumentsDefaultEntryHolder.defaultEntry);
@@ -346,14 +346,14 @@ public class AutoBoneWindow extends JFrame {
Float legsLength = autoBone.getConfig("Legs length");
Float kneeHeight = autoBone.getConfig("Knee height");
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 neckTorso = neckLength != null && torsoLength != null ? neckLength / torsoLength : 0f;
float chestTorso = chestDistance != null && torsoLength != null ? chestDistance / torsoLength : 0f;
float torsoWaist = hipWidth != null && torsoLength != null ? hipWidth / torsoLength : 0f;
float legTorso = 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-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) + "}]");
LogManager.log.info("[AutoBone] Ratios: [{Neck-Torso: " + StringUtils.prettyNumber(neckTorso) + "}, {Chest-Torso: " + StringUtils.prettyNumber(chestTorso) + "}, {Torso-Waist: " + StringUtils.prettyNumber(torsoWaist) + "}, {Leg-Torso: " + StringUtils.prettyNumber(legTorso) + "}, {Leg-Body: " + StringUtils.prettyNumber(legBody) + "}, {Knee-Leg: " + StringUtils.prettyNumber(kneeLeg) + "}]");
String lengthsString = getLengthsString();
LogManager.log.info("[AutoBone] Length values: " + lengthsString);