Fix start position
This commit is contained in:
parent
ff47263fce
commit
27fc3b7eb6
@ -1253,22 +1253,7 @@ namespace Passer.Humanoid {
|
||||
/// taller or smaller than the avatar itself.
|
||||
/// It retains 1:1 tracking and the X/Z position of the player are not affected.
|
||||
protected void SetTrackingHeightToAvatar() {
|
||||
//#if !pUNITYXR
|
||||
/*
|
||||
float localNeckHeight;
|
||||
if (headTarget.unity.cameraTransform == null ||
|
||||
UnityVRDevice.xrDevice == UnityVRDevice.XRDeviceType.None ||
|
||||
headTarget.head.target.confidence.position <= 0
|
||||
) {
|
||||
|
||||
localNeckHeight = headTarget.neck.target.transform.position.y - transform.position.y;
|
||||
}
|
||||
else {
|
||||
//Vector3 neckPosition = HeadMovements.CalculateNeckPosition(headTarget.unityVRHead.cameraTransform.position, headTarget.unityVRHead.cameraTransform.rotation, -headTarget.neck2eyes);
|
||||
//localNeckHeight = neckPosition.y - transform.position.y;
|
||||
localNeckHeight = headTarget.neck.target.transform.position.y - transform.position.y;
|
||||
}
|
||||
*/
|
||||
Vector3 neckPosition;
|
||||
if (headTarget.neck.target.confidence.position > 0.2F)
|
||||
neckPosition = headTarget.neck.target.transform.position;
|
||||
@ -1281,7 +1266,6 @@ namespace Passer.Humanoid {
|
||||
|
||||
float deltaY = avatarNeckHeight - playersNeckHeight;
|
||||
AdjustTrackingHeight(deltaY);
|
||||
//#endif
|
||||
}
|
||||
|
||||
//public void MoveTrackingHeightToAvatar() {
|
||||
@ -1442,7 +1426,16 @@ namespace Passer.Humanoid {
|
||||
|
||||
#region Calibration
|
||||
|
||||
public void SetStartPosition() {
|
||||
public virtual void SetStartPosition() {
|
||||
Vector3 localNeckPosition;
|
||||
if (headTarget.neck.target.confidence.position > 0.2F)
|
||||
localNeckPosition = headTarget.neck.target.transform.position - transform.position;
|
||||
else {
|
||||
Transform headTargetTransform = headTarget.head.target.transform;
|
||||
localNeckPosition = HeadMovements.CalculateNeckPositionFromEyes(headTargetTransform.position, headTargetTransform.rotation, -headTarget.neck2eyes) - transform.position;
|
||||
}
|
||||
Vector3 delta = new Vector3(-localNeckPosition.x, 0, -localNeckPosition.z);
|
||||
AdjustTracking(delta);
|
||||
}
|
||||
|
||||
/// <summary>Calibrates the tracking with the player</summary>
|
||||
|
Loading…
x
Reference in New Issue
Block a user