mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-04-06 02:01:58 +02:00
Fix skeleton with legs resolution
Fix trackers reset after the first time
This commit is contained in:
@@ -93,18 +93,18 @@ public class HumanPoseProcessor {
|
||||
Vector3f hmdFront = new Vector3f(0, 0, 1);
|
||||
hmdRotation.multLocal(hmdFront);
|
||||
hmdFront.multLocal(1, 0, 1).normalizeLocal();
|
||||
hmdRotation.lookAt(hmdFront, Vector3f.UNIT_Y);
|
||||
//hmdRotation.lookAt(hmdFront, Vector3f.UNIT_Y);
|
||||
|
||||
Iterator<AdjustedTracker> iterator = trackers.values().iterator();
|
||||
while(iterator.hasNext()) {
|
||||
AdjustedTracker tt = iterator.next();
|
||||
tt.getRotation(sensorRotation);
|
||||
tt.tracker.getRotation(sensorRotation);
|
||||
|
||||
// Adjust only yaw rotation
|
||||
Vector3f sensorFront = new Vector3f(0, 0, 1);
|
||||
sensorRotation.multLocal(sensorFront);
|
||||
sensorFront.multLocal(1, 0, 1).normalizeLocal();
|
||||
sensorRotation.lookAt(sensorFront, Vector3f.UNIT_Y);
|
||||
//sensorRotation.lookAt(sensorFront, Vector3f.UNIT_Y);
|
||||
|
||||
|
||||
tt.position.baseRotation.mult(hmdRotation, targetTrackerRotation);
|
||||
|
||||
@@ -45,10 +45,10 @@ public class HumanSekeletonWithLegs extends HumanSkeleonWithWaist {
|
||||
computedRightAnkleTracker = rat;
|
||||
|
||||
waistNode.attachChild(leftLegNode);
|
||||
leftLegNode.localTransform.setTranslation(-hipsWidth / 2, 0, 0);
|
||||
leftLegNode.localTransform.setTranslation(hipsWidth / 2, 0, 0);
|
||||
|
||||
waistNode.attachChild(rightLegNode);
|
||||
rightLegNode.localTransform.setTranslation(hipsWidth / 2, 0, 0);
|
||||
rightLegNode.localTransform.setTranslation(-hipsWidth / 2, 0, 0);
|
||||
|
||||
leftLegNode.attachChild(leftKneeNode);
|
||||
leftKneeNode.localTransform.setTranslation(0, -kneeLength, 0);
|
||||
@@ -74,9 +74,11 @@ public class HumanSekeletonWithLegs extends HumanSkeleonWithWaist {
|
||||
|
||||
leftAnkleTracker.getRotation(qBuf);
|
||||
leftKneeNode.localTransform.setRotation(qBuf);
|
||||
leftAnkleNode.localTransform.setRotation(qBuf);
|
||||
|
||||
rightAnkleTracker.getRotation(qBuf);
|
||||
rightKneeNode.localTransform.setRotation(qBuf);
|
||||
rightAnkleNode.localTransform.setRotation(qBuf);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -55,6 +55,7 @@ public class HumanSkeleonWithWaist extends HumanSkeleton {
|
||||
hmdTracker.getPosition(vBuf);
|
||||
hmdNode.localTransform.setTranslation(vBuf);
|
||||
hmdNode.localTransform.setRotation(qBuf);
|
||||
waistNode.localTransform.setRotation(qBuf);
|
||||
}
|
||||
|
||||
protected void updateComputedTrackers() {
|
||||
|
||||
@@ -33,7 +33,18 @@ public class TransformNode {
|
||||
if(localRotation)
|
||||
worldTransform.combineWithParent(parent.worldTransform);
|
||||
else
|
||||
worldTransform.combineWithParentGlobalRotation(localTransform);
|
||||
combineWithParentGlobalRotation(parent.worldTransform);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void combineWithParentGlobalRotation(Transform parent) {
|
||||
worldTransform.getScale().multLocal(parent.getScale());
|
||||
worldTransform.getTranslation().multLocal(parent.getScale());
|
||||
|
||||
parent
|
||||
.getRotation()
|
||||
.multLocal(worldTransform.getTranslation())
|
||||
.addLocal(parent.getTranslation());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user