mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-11-24 02:51:20 -08:00
Better reset and initial values
owo
This commit is contained in:
1 parent
34174b442f
commit
21eff5e1ba
4 files changed
+18
-13
No files matched your search
@@ -91,15 +91,15 @@ public class AutoBone {
|
||||
// Load waist 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.85f));
|
||||
configs.put("Waist", server.config.getFloat("body.waistDistance", 0.64f));
|
||||
|
||||
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.42f));
|
||||
configs.put("Chest", server.config.getFloat("body.chestDistance", 0.32f));
|
||||
} else {
|
||||
// Otherwise, make sure it's not used
|
||||
configs.remove("Chest");
|
||||
staticConfigs.put("Chest", server.config.getFloat("body.chestDistance", 0.42f));
|
||||
staticConfigs.put("Chest", server.config.getFloat("body.chestDistance", 0.32f));
|
||||
}
|
||||
|
||||
// Load leg configs
|
||||
|
||||
@@ -23,12 +23,17 @@ public class SimpleSkeleton {
|
||||
protected final TransformNode neckNode = new TransformNode("Neck", false);
|
||||
protected final TransformNode waistNode = new TransformNode("Waist", false);
|
||||
protected final TransformNode chestNode = new TransformNode("Chest", false);
|
||||
protected final TransformNode hipNode = new TransformNode("Hip", false);
|
||||
|
||||
protected float chestDistance = 0.42f;
|
||||
protected float chestDistance = 0.32f;
|
||||
/**
|
||||
* Distance from eyes to waist
|
||||
*/
|
||||
protected float waistDistance = 0.85f;
|
||||
protected float waistDistance = 0.64f;
|
||||
/**
|
||||
* Distance from waist to hip
|
||||
*/
|
||||
protected float hipDistance = 0.05f;
|
||||
/**
|
||||
* Distance from eyes to the base of the neck
|
||||
*/
|
||||
|
||||
@@ -167,7 +167,7 @@ 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 - DEFAULT_FLOOR_OFFSET);
|
||||
setSkeletonConfig(joint, height - neckLength - waistDistance - hipDistance - DEFAULT_FLOOR_OFFSET);
|
||||
}
|
||||
resetSkeletonConfig("Knee height");
|
||||
break;
|
||||
|
||||
@@ -41,15 +41,15 @@ public class HumanSkeletonWithWaist extends HumanSkeleton {
|
||||
protected final TransformNode trackerWaistNode = new TransformNode("Waist-Tracker", false);
|
||||
protected final TransformNode hipNode = new TransformNode("Hip", false);
|
||||
|
||||
protected float chestDistance = 0.42f;
|
||||
protected float chestDistance = 0.32f;
|
||||
/**
|
||||
* Distance from eyes to waist
|
||||
*/
|
||||
protected float waistDistance = 0.85f;
|
||||
protected float waistDistance = 0.64f;
|
||||
/**
|
||||
* Distance from waist to hip
|
||||
*/
|
||||
protected float hipDistance = 0f;
|
||||
protected float hipDistance = 0.05f;
|
||||
/**
|
||||
* Distance from eyes to waist, defines reported
|
||||
* tracker position, if you want to move resulting
|
||||
@@ -124,9 +124,9 @@ public class HumanSkeletonWithWaist extends HumanSkeleton {
|
||||
resetSkeletonConfig("Head");
|
||||
resetSkeletonConfig("Neck");
|
||||
resetSkeletonConfig("Virtual waist");
|
||||
resetSkeletonConfig("Hip");
|
||||
resetSkeletonConfig("Waist");
|
||||
resetSkeletonConfig("Chest");
|
||||
resetSkeletonConfig("Hip");
|
||||
break;
|
||||
case "Head":
|
||||
setSkeletonConfig(joint, HEAD_SHIFT_DEFAULT);
|
||||
@@ -138,17 +138,17 @@ public class HumanSkeletonWithWaist extends HumanSkeleton {
|
||||
setSkeletonConfig(joint, 0.0f);
|
||||
break;
|
||||
case "Chest":
|
||||
setSkeletonConfig(joint, waistDistance / 2.0f);
|
||||
setSkeletonConfig(joint, (waistDistance / 2.0f) - hipDistance);
|
||||
break;
|
||||
case "Hip":
|
||||
setSkeletonConfig(joint, 0.0f);
|
||||
setSkeletonConfig(joint, 0.05f);
|
||||
break;
|
||||
case "Waist": // Puts Waist in the middle of the height
|
||||
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);
|
||||
setSkeletonConfig(joint, ((height) / 2.0f) - hipDistance);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user