修改线脚本

This commit is contained in:
2026-03-22 12:30:09 +08:00
parent 01fe2e7d98
commit 6390924d3b
5 changed files with 808 additions and 4 deletions

View File

@@ -284,6 +284,24 @@ public class Rope : MonoBehaviour
return totalLength;
}
public float GetPhysicsPolylineLength()
{
float total = 0f;
for (int i = 1; i < _physicsNodes; i++)
total += Vector3.Distance(_pCurr[i - 1], _pCurr[i]);
return total;
}
public void DebugLength()
{
Debug.Log(
$"current={_currentLength}, target={_targetLength}, nodes={_physicsNodes}, " +
$"seg={physicsSegmentLen}, head={_headRestLen}, headMin={headMinLen}, " +
$"solverRestTotal={(_physicsNodes - 2) * physicsSegmentLen + _headRestLen}, " +
$"poly={GetPhysicsPolylineLength()}"
);
}
private void FixedUpdate()
{