Skip to content

Commit

Permalink
fixed fbik
Browse files Browse the repository at this point in the history
dooly123 committed Jan 13, 2025
1 parent 96104f6 commit 2376d36
Showing 5 changed files with 8 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -124,8 +124,6 @@ public static void FullBodyCalibration()
BasisDebug.LogError("Missing Tracker for index " + Index + " with ID " + mapping);
}
}
//do the roles after to stop the animator switch issue
BasisLocalPlayer.Instance.LocalBoneDriver.CalculateHeading();

BasisLocalPlayer.Instance.AvatarDriver.ResetAvatarAnimator();
BasisLocalPlayer.Instance.AvatarDriver.CalibrateRoles();//not needed but still doing just incase
@@ -261,4 +259,4 @@ public static float MaxDistanceBeforeMax(BasisBoneTrackedRole role)
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -17,11 +17,11 @@ public class BasisBoneControl
public float LerpAmountNormal;
public float LerpAmountFastMovement;
public float AngleBeforeSpeedup;
public bool HasRotationalTarget;
public bool HasRotationalTarget = false;

public bool HasLineDraw;
public int LineDrawIndex;
public bool HasTarget;
public bool HasTarget = false;
public float3 Offset;
public float LerpAmount;

@@ -61,15 +61,15 @@ public void ComputeMovement(float DeltaTime)
{
if (IsHintRoleIgnoreRotation == false)
{ // Update the position of the secondary transform to maintain the initial offset
OutGoingData.position = math.lerp(OutGoingData.position, IncomingData.position + math.mul(IncomingData.rotation, InverseOffsetFromBone.position), trackersmooth);
OutGoingData.position = Vector3.Lerp(OutGoingData.position, IncomingData.position + math.mul(IncomingData.rotation, InverseOffsetFromBone.position), trackersmooth);
// Update the rotation of the secondary transform to maintain the initial offset
OutGoingData.rotation = math.slerp(OutGoingData.rotation, math.mul(IncomingData.rotation, InverseOffsetFromBone.rotation), trackersmooth);
OutGoingData.rotation = Quaternion.Slerp(OutGoingData.rotation, math.mul(IncomingData.rotation, InverseOffsetFromBone.rotation), trackersmooth);
}
else
{
OutGoingData.rotation = Quaternion.identity;
// Update the position of the secondary transform to maintain the initial offset
OutGoingData.position = math.lerp(OutGoingData.position, IncomingData.position + math.mul(IncomingData.rotation, InverseOffsetFromBone.position), trackersmooth);
OutGoingData.position = Vector3.Lerp(OutGoingData.position, IncomingData.position + math.mul(IncomingData.rotation, InverseOffsetFromBone.position), trackersmooth);
}
}
else
16 changes: 0 additions & 16 deletions Basis/Packages/com.basis.framework/Drivers/BaseBoneDriver.cs
Original file line number Diff line number Diff line change
@@ -23,10 +23,6 @@ public abstract class BaseBoneDriver : MonoBehaviour
public event SimulationHandler OnSimulate;
public event SimulationHandler OnPostSimulate;
public OrderedDelegate ReadyToRead = new OrderedDelegate();

public Quaternion QatCalibrationHeading;
public Vector3 CalibrationHeading;
public float CalibrationHeadingY;
/// <summary>
/// call this after updating the bone data
/// </summary>
@@ -79,18 +75,6 @@ public void SimulateAndApplyWithoutLerp()
SimulateWithoutLerp();
ApplyMovement();
}
public void CalculateHeading()
{
if (FindBone(out BasisBoneControl Head, BasisBoneTrackedRole.Head))
{
CalibrationHeadingY = Head.BoneTransform.localRotation.eulerAngles.y;
CalibrationHeading = new Vector3(0, CalibrationHeadingY, 0);
QatCalibrationHeading = Quaternion.Euler(CalibrationHeading);
Debug.DrawLine(Head.BoneTransform.position, Head.BoneTransform.position + (QatCalibrationHeading * new Vector3(0, 0, 1)), Color.black, 5f);
// Head.BoneModelTransform.position = Head.BoneTransform.position;
// Head.BoneModelTransform.rotation = Head.BoneTransform.rotation;
}
}
public void RemoveAllListeners()
{
for (int Index = 0; Index < ControlsLength; Index++)
Original file line number Diff line number Diff line change
@@ -105,7 +105,6 @@ public void InitialLocalCalibration(BasisLocalPlayer Player)
Builder.enabled = false;
Calibration(Player.BasisAvatar);
BasisLocalPlayer.Instance.LocalBoneDriver.RemoveAllListeners();
BasisLocalPlayer.Instance.LocalBoneDriver.CalculateHeading();
BasisLocalEyeFollowDriver = BasisHelpers.GetOrAddComponent<BasisLocalEyeFollowBase>(Player.BasisAvatar.gameObject);
BasisLocalEyeFollowDriver.Initalize(this,Player);
HeadScaledDown = Vector3.zero;
@@ -603,4 +602,4 @@ public GameObject CreateRig(string Role, bool Enabled, out Rig Rig, out RigLayer
return RigGameobject;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -178,5 +178,6 @@ private void ApplyPositionControl(BasisBoneControl boneControl)
float3 customDirection = math.mul(boneControl.Target.OutGoingData.rotation, boneControl.Offset);
boneControl.OutGoingData.position = boneControl.Target.OutGoingData.position + customDirection;
}

}
}

0 comments on commit 2376d36

Please sign in to comment.