Skip to content

Commit

Permalink
Merge pull request #71 from Louka3000/main
Browse files Browse the repository at this point in the history
Foot Offset and Updated Icons
  • Loading branch information
Eirenliel committed Oct 22, 2021
2 parents 0e61460 + 3fa22fa commit 8c356b4
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 5 deletions.
7 changes: 7 additions & 0 deletions src/main/java/dev/slimevr/gui/SkeletonConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,13 @@ public void mouseClicked(MouseEvent e) {
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));
Expand Down
21 changes: 17 additions & 4 deletions src/main/java/io/eiren/vr/processor/HumanSkeletonWithLegs.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public class HumanSkeletonWithLegs extends HumanSkeletonWithWaist {
*/
protected float legsLength = 0.84f;
protected float footLength = FOOT_LENGTH_DEFAULT;
protected float footOffset = 0f; //horizontal forward/backwards translation feet offset for avatars with bent knees

protected float minKneePitch = 0f * FastMath.DEG_TO_RAD;
protected float maxKneePitch = 90f * FastMath.DEG_TO_RAD;
Expand Down Expand Up @@ -106,6 +107,7 @@ public HumanSkeletonWithLegs(VRServer server, List<ComputedHumanPoseTracker> com
kneeHeight = server.config.getFloat("body.kneeHeight", kneeHeight);
legsLength = server.config.getFloat("body.legsLength", legsLength);
footLength = server.config.getFloat("body.footLength", footLength);
footOffset = server.config.getFloat("body.footOffset", footOffset);
//extendedPelvisModel = server.config.getBoolean("body.model.extendedPelvis", extendedPelvisModel);
extendedKneeModel = server.config.getBoolean("body.model.extendedKnee", extendedKneeModel);

Expand All @@ -122,10 +124,10 @@ public HumanSkeletonWithLegs(VRServer server, List<ComputedHumanPoseTracker> com
rightKneeNode.localTransform.setTranslation(0, -(legsLength - kneeHeight), 0);

leftKneeNode.attachChild(leftAnkleNode);
leftAnkleNode.localTransform.setTranslation(0, -kneeHeight, 0);
leftAnkleNode.localTransform.setTranslation(0, -kneeHeight, -footOffset);

rightKneeNode.attachChild(rightAnkleNode);
rightAnkleNode.localTransform.setTranslation(0, -kneeHeight, 0);
rightAnkleNode.localTransform.setTranslation(0, -kneeHeight, -footOffset);

leftAnkleNode.attachChild(leftFootNode);
leftFootNode.localTransform.setTranslation(0, 0, -footLength);
Expand All @@ -137,6 +139,7 @@ public HumanSkeletonWithLegs(VRServer server, List<ComputedHumanPoseTracker> com
configMap.put("Legs length", legsLength);
configMap.put("Knee height", kneeHeight);
configMap.put("Foot length", footLength);
configMap.put("Foot offset", footOffset);
}

@Override
Expand All @@ -147,6 +150,7 @@ public void resetSkeletonConfig(String joint) {
// Resets from the parent already performed
resetSkeletonConfig("Hips width");
resetSkeletonConfig("Foot length");
resetSkeletonConfig("Foot offset");
resetSkeletonConfig("Legs length");
break;
case "Hips width":
Expand All @@ -155,6 +159,9 @@ public void resetSkeletonConfig(String joint) {
case "Foot length":
setSkeletonConfig(joint, FOOT_LENGTH_DEFAULT);
break;
case "Foot offset":
setSkeletonConfig(joint, 0f);
break;
case "Legs length": // Set legs length to be 5cm above floor level
Vector3f vec = new Vector3f();
hmdTracker.getPosition(vec);
Expand Down Expand Up @@ -183,8 +190,8 @@ public void setSkeletonConfig(String joint, float newLength) {
case "Knee height":
kneeHeight = newLength;
server.config.setProperty("body.kneeHeight", kneeHeight);
leftAnkleNode.localTransform.setTranslation(0, -kneeHeight, 0);
rightAnkleNode.localTransform.setTranslation(0, -kneeHeight, 0);
leftAnkleNode.localTransform.setTranslation(0, -kneeHeight, -footOffset);
rightAnkleNode.localTransform.setTranslation(0, -kneeHeight, -footOffset);
leftKneeNode.localTransform.setTranslation(0, -(legsLength - kneeHeight), 0);
rightKneeNode.localTransform.setTranslation(0, -(legsLength - kneeHeight), 0);
break;
Expand All @@ -200,6 +207,12 @@ public void setSkeletonConfig(String joint, float newLength) {
leftFootNode.localTransform.setTranslation(0, 0, -footLength);
rightFootNode.localTransform.setTranslation(0, 0, -footLength);
break;
case "Foot offset":
footOffset = newLength;
server.config.setProperty("body.footOffset", footOffset);
leftAnkleNode.localTransform.setTranslation(0, -kneeHeight, -footOffset);
rightAnkleNode.localTransform.setTranslation(0, -kneeHeight, -footOffset);
break;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class HumanSkeletonWithWaist extends HumanSkeleton {
*/
protected float trackerWaistDistance = 0.0f;
/**
* Distacne from eyes to the base of the neck
* Distance from eyes to the base of the neck
*/
protected float neckLength = NECK_LENGTH_DEFAULT;
/**
Expand Down
Binary file modified src/main/resources/icon128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/main/resources/icon16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/main/resources/icon256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/main/resources/icon32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/main/resources/icon48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/main/resources/icon64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8c356b4

Please sign in to comment.