diff --git a/Assets/Scripts/FixSystemNew/BodyModule/CableReel.cs b/Assets/Scripts/FixSystemNew/BodyModule/CableReel.cs index 604bbaac9..6c34d1f17 100644 --- a/Assets/Scripts/FixSystemNew/BodyModule/CableReel.cs +++ b/Assets/Scripts/FixSystemNew/BodyModule/CableReel.cs @@ -92,10 +92,11 @@ namespace AibisDream.FixSystem return; } - // 线缆还有余量时不驱动转盘,避免"还没拉紧就先转" + // 松弛时不驱动转盘,并缓动回正,避免出线口对着插头“预判”朝向 if (tautness <= 0f) { - angularVelocity *= Mathf.Exp(-angularDamping * Time.deltaTime); + angularVelocity = 0f; + currentAngle = Mathf.LerpAngle(currentAngle, 0f, returnSpeed * Time.deltaTime); ApplyRotation(); return; } diff --git a/Assets/Scripts/FixSystemNew/Cable/PhysicCable.cs b/Assets/Scripts/FixSystemNew/Cable/PhysicCable.cs index f802fa638..05e6fb24e 100644 --- a/Assets/Scripts/FixSystemNew/Cable/PhysicCable.cs +++ b/Assets/Scripts/FixSystemNew/Cable/PhysicCable.cs @@ -96,16 +96,21 @@ public class PhysicCable : MonoBehaviour public float CurrentLength => _length; - /// 0=完全松弛,1=绷直。线盘只在真正拉紧后才应转动。 - public float GetTautness(float slackMargin = 0.35f) + /// + /// 0=完全松弛,1=绷直。已扣除送线故意留的余量(1.04×直线距 + lengthMargin), + /// 避免「有设计余量就永远不转」;线盘只在真正被拽时才应转动。 + /// + public float GetTautness(float extraSlackMargin = 0.2f) { if (State != CableState.Dragging && State != CableState.Plugged) return 0f; if (_pts == null || startTransform == null) return 0f; float straightDist = Vector3.Distance(startTransform.position, FlattenZ(EndPosition)); - float slack = _length - straightDist; - if (slack >= slackMargin) return 0f; - return 1f - Mathf.Clamp01(slack / slackMargin); + float baselineLength = straightDist * 1.04f + lengthMargin; + float extraSlack = _length - baselineLength; + if (extraSlack >= extraSlackMargin) return 0f; + if (extraSlack <= 0f) return 1f; + return 1f - extraSlack / extraSlackMargin; } private struct Particle diff --git a/Assets/Scripts/FixSystemNew/Screen System/FixPanel/CablePanel.cs b/Assets/Scripts/FixSystemNew/Screen System/FixPanel/CablePanel.cs index 3750de779..117496bb7 100644 --- a/Assets/Scripts/FixSystemNew/Screen System/FixPanel/CablePanel.cs +++ b/Assets/Scripts/FixSystemNew/Screen System/FixPanel/CablePanel.cs @@ -199,15 +199,14 @@ namespace AibisDream.FixSystem private void Update() { - // 拖拽/插接时转盘朝插头方向转动,闲置时缓动回正。 - // 不再要求线缆完全绷紧,否则送线会让 tautness 长时间为 0,视觉上看不到旋转。 + // 仅拖拽时由拉力驱动出线口倾斜;插接/松弛不预判朝向插头。 + // GetTautness 已扣除送线设计余量,绷紧时才会转。 if (CableReelRef != null && physicCableRef != null && physicCableRef.State != PhysicCable.CableState.Hidden) { - bool active = physicCableRef.State == PhysicCable.CableState.Dragging - || physicCableRef.State == PhysicCable.CableState.Plugged - || physicCableRef.State == PhysicCable.CableState.Collapsing; - CableReelRef.UpdateRotation(active); + bool active = physicCableRef.State == PhysicCable.CableState.Dragging; + float tautness = active ? physicCableRef.GetTautness() : 0f; + CableReelRef.UpdateRotation(active, tautness); } }