Skip to content

Commit 14a5d93

Browse files
committed
added fading to the hint when near
1 parent d4b499e commit 14a5d93

9 files changed

Lines changed: 63 additions & 7 deletions

File tree

Basis/Assets/AddressableAssetsData/AddressableAssetSettings.asset

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ MonoBehaviour:
1515
m_DefaultGroup: 37c75a6cf72db324eb01200602299fc8
1616
m_currentHash:
1717
serializedVersion: 2
18-
Hash: 00000000000000000000000000000000
18+
Hash: 5fb38613a650df59b01d34675473340b
1919
m_OptimizeCatalogSize: 0
2020
m_BuildRemoteCatalog: 0
2121
m_CatalogRequestsTimeout: 0

Basis/Assets/XR/Settings/OpenVRSettings.asset

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ MonoBehaviour:
1818
StereoRenderingMode: 1
1919
InitializationType: 1
2020
EditorAppKey: application.generated.unity.basisunity.exe
21-
ActionManifestFileRelativeFilePath: StreamingAssets\SteamVR\actions.json
21+
ActionManifestFileRelativeFilePath: C:/Users/doola/OneDrive/Documents/Github/Basis/Basis/Assets/StreamingAssets\SteamVR\actions.json
2222
MirrorView: 2
2323
PreInit: 0
2424
HasCopiedDefaults: 0

Basis/Packages/com.basis.framework/Avatar/BasisAvatarIKStageCalibration.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ public class BasisCalibrationData
130130
/// same trackers map the same way whether the user wears a child avatar or a
131131
/// three-meter giant.
132132
/// </summary>
133+
/// <summary>Raised at the end of <see cref="FullBodyCalibration"/>, after tracker roles have been (re)assigned.</summary>
134+
public static System.Action OnFullBodyCalibrated;
135+
133136
public static void FullBodyCalibration()
134137
{
135138
BasisHeightDriver.OnAvatarFBCalibration();//avatar height is good,player height is needed
@@ -160,6 +163,8 @@ public static void FullBodyCalibration()
160163
// newly stored avatar bone transforms. No-op when the ShowGizmos
161164
// master toggle is off; the toggle path rebuilds when it flips on.
162165
BasisLocalPlayer.Instance.LocalBoneDriver.RebuildCalibrationSpheres();
166+
167+
OnFullBodyCalibrated?.Invoke();
163168
}
164169

165170
/// <summary>

Basis/Packages/com.basis.framework/Avatar/BasisTrackerPairing.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,19 @@ private static void UnlinkInternal(string id, bool raiseEvent, bool persist)
134134
}
135135
}
136136

137+
/// <summary>
138+
/// Remove every pairing. Persists and fires <see cref="OnPairingsChanged"/>
139+
/// once. No-op if there are none.
140+
/// </summary>
141+
public static void ClearAll()
142+
{
143+
EnsureLoaded();
144+
if (_pairs.Count == 0) return;
145+
_pairs.Clear();
146+
Save();
147+
OnPairingsChanged?.Invoke();
148+
}
149+
137150
/// <summary>
138151
/// Snapshot enumeration of pairings, with each pair reported once from the
139152
/// canonical side. Useful for diagnostics or UI summaries.

Basis/Packages/com.basis.framework/Avatar/BasisTrackerRoleOverride.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,18 @@ public static void ClearOverride(string id)
7575
OnOverridesChanged?.Invoke();
7676
}
7777

78+
/// <summary>
79+
/// Remove every override. No-op if there are none.
80+
/// </summary>
81+
public static void ClearAll()
82+
{
83+
EnsureLoaded();
84+
if (_overrides.Count == 0) return;
85+
_overrides.Clear();
86+
Save();
87+
OnOverridesChanged?.Invoke();
88+
}
89+
7890
// ----------------------------------------------------------------
7991
// Persistence
8092
// ----------------------------------------------------------------

Basis/Packages/com.basis.framework/BasisUI/Localization/Languages/en.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,10 @@
162162
"key": "trackerLinking.identifyDescription",
163163
"value": "Light up a glowing sphere on this tracker so you can spot which physical device it is. Press again to turn it off."
164164
},
165+
{
166+
"key": "trackerLinking.identifyCalibratedRole",
167+
"value": "({0})"
168+
},
165169
{
166170
"key": "trackerLinking.trackers.title",
167171
"value": "Connected Trackers"

Basis/Packages/com.basis.framework/BasisUI/Menus/Main Menu Providers/SettingsProviderParts/SettingsProviderTrackerSettings.cs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using Basis.Scripts.Device_Management;
55
using Basis.Scripts.Device_Management.Devices;
66
using Basis.Scripts.Device_Management.Devices.Pairing;
7+
using Basis.Scripts.Drivers;
78
using Basis.Scripts.TransformBinders.BoneControl;
89
using System;
910
using System.Collections.Generic;
@@ -158,6 +159,8 @@ public static PanelTabPage TrackerSettingsTab(PanelTabGroup tabGroup)
158159
BasisTrackerPairing.OnPairingsChanged += handleChange;
159160
BasisTrackerRoleOverride.OnOverridesChanged += handleChange;
160161
BasisTrackerIdentifyGizmos.OnIdentifyChanged += handleChange;
162+
BasisLocalAvatarDriver.CalibrationComplete += handleChange;
163+
BasisAvatarIKStageCalibration.OnFullBodyCalibrated += handleChange;
161164

162165
tabPage.OnInstanceReleased += () =>
163166
{
@@ -169,6 +172,8 @@ public static PanelTabPage TrackerSettingsTab(PanelTabGroup tabGroup)
169172
BasisTrackerPairing.OnPairingsChanged -= handleChange;
170173
BasisTrackerRoleOverride.OnOverridesChanged -= handleChange;
171174
BasisTrackerIdentifyGizmos.OnIdentifyChanged -= handleChange;
175+
BasisLocalAvatarDriver.CalibrationComplete -= handleChange;
176+
BasisAvatarIKStageCalibration.OnFullBodyCalibrated -= handleChange;
172177
state.TrackersContainer = null;
173178
state.TrackersGroup = null;
174179
state.TabDescriptor = null;
@@ -438,16 +443,24 @@ private static void ApplyIdentifyVisual(PanelButton button, BasisInput input)
438443
PanelElementDescriptor descriptor = button.Descriptor;
439444
if (descriptor == null || !descriptor.HasTitle) return;
440445

446+
string label;
441447
if (BasisTrackerIdentifyGizmos.TryGetColor(input, out Color color))
442448
{
443449
string hex = ColorUtility.ToHtmlStringRGB(color);
444-
descriptor.SetTitle($"<b><color=#{hex}>{BasisLocalization.Get("trackerLinking.identifyShowing")}</color></b>");
450+
label = $"<b><color=#{hex}>{BasisLocalization.Get("trackerLinking.identifyShowing")}</color></b>";
445451
}
446452
else
447453
{
448454
string accentHex = ColorUtility.ToHtmlStringRGB(ResolveAccentColor());
449-
descriptor.SetTitle($"<b><color=#{accentHex}>{BasisLocalization.Get("trackerLinking.identifyLabel")}</color></b>");
455+
label = $"<b><color=#{accentHex}>{BasisLocalization.Get("trackerLinking.identifyLabel")}</color></b>";
450456
}
457+
458+
if (input != null && input.TryGetRole(out BasisBoneTrackedRole role))
459+
{
460+
label += $" <size=85%>{BasisLocalization.Get("trackerLinking.identifyCalibratedRole", role.ToString())}</size>";
461+
}
462+
463+
descriptor.SetTitle(label);
451464
}
452465

453466
private static Color ResolveAccentColor()
@@ -629,6 +642,8 @@ private static void ResetTrackerSettingsDefaults()
629642
BasisSettingsDefaults.PairingDistanceEmaAlpha.ResetToDefault();
630643
BasisSettingsDefaults.PairingWeightSmoothing.ResetToDefault();
631644
BasisSettingsDefaults.PairingRotationHalfLife.ResetToDefault();
645+
BasisTrackerRoleOverride.ClearAll();
646+
BasisTrackerPairing.ClearAll();
632647
BasisTrackerIdentifyGizmos.ClearAll();
633648
}
634649

Basis/Packages/com.basis.framework/IK/BasisFullBodyIK.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2206,10 +2206,17 @@ public void SolveTwoBoneIKArms(AnimationStream stream, ReadWriteTransformHandle
22062206
Vector3 abProj = ab - acNorm * Vector3.Dot(ab, acNorm);
22072207
Vector3 ahProj = ah - acNorm * Vector3.Dot(ah, acNorm);
22082208

2209-
// you can also soften this threshold if hinting fights with max reach
2210-
if (abProj.sqrMagnitude > (totalLen * totalLen * 0.001f) && ahProj.sqrMagnitude > 0f)
2209+
// Near full extension the elbow sits on the shoulder->hand axis, so ahProj collapses
2210+
// and FromToRotation spins on tracker noise. Fade the hint out as SolveTwoBone does.
2211+
float reachRatio = (totalLen > k_Epsilon) ? (atCorrectedLen / totalLen) : 0f;
2212+
float hintFade = (reachRatio > 0.9f) ? 1f - Mathf.Clamp01((reachRatio - 0.9f) / 0.1f) : 1f;
2213+
if (hintFade > 0f && abProj.sqrMagnitude > (totalLen * totalLen * 0.001f) && ahProj.sqrMagnitude > (totalLen * totalLen * 0.001f))
22112214
{
22122215
Quaternion hintR = QuaternionExt.FromToRotation(abProj, ahProj);
2216+
if (hintFade < 1f)
2217+
{
2218+
hintR = Quaternion.Slerp(Quaternion.identity, hintR, hintFade);
2219+
}
22132220
hintR = QuaternionExt.NormalizeSafe(hintR);
22142221
root.SetRotation(stream, hintR * root.GetRotation(stream));
22152222
}

Basis/ProjectSettings/QualitySettings.asset

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ QualitySettings:
2222
globalTextureMipmapLimit: 0
2323
textureMipmapLimitSettings: []
2424
anisotropicTextures: 1
25-
antiAliasing: 4
25+
antiAliasing: 2
2626
softParticles: 1
2727
softVegetation: 1
2828
realtimeReflectionProbes: 1

0 commit comments

Comments
 (0)