Refactor: extract shared helpers across scripts, trim remaining doc redundancy
Deduplication pass (44 extractions): - New SmoothedLook: shared smoothed yaw/pitch look tick + view seeding (FirstPersonController, FreeCamController) - New CharacterTeleport: disable-CC-around-teleport idiom (rescue, owner position apply, free-cam sync) - New GeometryUtil: RescaleToUnitScale + TransformBounds (concealment meter/volume, skinned collider baker) - Paint family: canonical map read/write shared between Net and Persistence, snapshot decode, backend stroke dispatch, RebuildBackend, ResolveSeed, chunked RPC send/gate/copy, CamoKnobs/HeightKnobs aggregates, SanitizeFileKey, NewMaskTexture, AdoptAlbedo, FindSlider - Player/modes: GameMode SetPlayerControl/SetPainting/SetOrbitInputEnabled, InputUtil.GameplayKeyPressed, NearestClimbHit, ComputeXRay delegates to ComputeResolutionFreeze, FingerIK TryInPlaneAngle - Match/misc: UnhookSessionCallbacks, SendEmptyNamedMessage, SwapScenes, RunSessionOpAsync, CovarianceEigen, CollectClusterPoints, MatchHud GUIStyle cache, HsvColorPicker rehook, VoxelCenter Documentation pass: remove 6 triplicated doc blocks and 2 restating inline comments left after the previous reduction. Behavior-neutral; hot-path rasterizer loops intentionally untouched. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
066e308cde
commit
2243cc823e
40 files changed
+681
-724
No files matched your search
@@ -306,11 +306,8 @@ public class FingerIK : MonoBehaviour
|
||||
|
||||
// World hinge axis (invariant under the joint's own twist about local X).
|
||||
Vector3 axisW = (j.rotation * HingeAxis(i)).normalized;
|
||||
Vector3 tipPlane = Vector3.ProjectOnPlane(toTip, axisW);
|
||||
Vector3 tgtPlane = Vector3.ProjectOnPlane(toTarget, axisW);
|
||||
if (tipPlane.sqrMagnitude < 1e-10f || tgtPlane.sqrMagnitude < 1e-10f) continue;
|
||||
if (!TryInPlaneAngle(toTip, toTarget, axisW, out float hingeAng)) continue;
|
||||
|
||||
float hingeAng = Vector3.SignedAngle(tipPlane, tgtPlane, axisW);
|
||||
j.rotation = Quaternion.AngleAxis(hingeAng, axisW) * j.rotation;
|
||||
|
||||
ConstrainToHinge(i);
|
||||
@@ -367,16 +364,25 @@ public class FingerIK : MonoBehaviour
|
||||
Vector3 toTip = tip.position - b.position;
|
||||
Vector3 toTarget = target.position - b.position;
|
||||
|
||||
float latAng = 0f;
|
||||
Vector3 tipPlane = Vector3.ProjectOnPlane(toTip, axisW);
|
||||
Vector3 tgtPlane = Vector3.ProjectOnPlane(toTarget, axisW);
|
||||
if (tipPlane.sqrMagnitude > 1e-10f && tgtPlane.sqrMagnitude > 1e-10f)
|
||||
latAng = Vector3.SignedAngle(tipPlane, tgtPlane, axisW);
|
||||
TryInPlaneAngle(toTip, toTarget, axisW, out float latAng); // degenerate -> 0 (spread bias still applies)
|
||||
|
||||
latAng = Mathf.Clamp(latAng + spread, spreadLimits.x, spreadLimits.y);
|
||||
_solvedLocal[0] = _solvedLocal[0] * Quaternion.AngleAxis(latAng, SpreadAxis);
|
||||
}
|
||||
|
||||
// Signed angle from toTip to toTarget projected onto the plane orthogonal to axis; false when
|
||||
// either projection is degenerate (angle is then 0 and must not be applied as a solve step).
|
||||
private static bool TryInPlaneAngle(Vector3 toTip, Vector3 toTarget, Vector3 axis, out float angle)
|
||||
{
|
||||
angle = 0f;
|
||||
Vector3 tipPlane = Vector3.ProjectOnPlane(toTip, axis);
|
||||
Vector3 tgtPlane = Vector3.ProjectOnPlane(toTarget, axis);
|
||||
if (tipPlane.sqrMagnitude < 1e-10f || tgtPlane.sqrMagnitude < 1e-10f) return false;
|
||||
|
||||
angle = Vector3.SignedAngle(tipPlane, tgtPlane, axis);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Base-joint spread/opposition about local Z, composed AFTER curl so the two DOFs don't
|
||||
// fight. Applied on the final base rotation when IK isn't driving the base laterally.
|
||||
private void ApplySpread()
|
||||
|
||||
Reference in new issue
Block a user