修改绳的逻辑

This commit is contained in:
2026-04-16 10:38:26 +08:00
parent a0fa4e6e9c
commit 9681d7526f
4 changed files with 23 additions and 2 deletions

View File

@@ -44,6 +44,8 @@ namespace NBF
set => nodeType = value;
}
public float Lenght => _joint != null ? _joint.linearLimit.limit : 0f;
public Rigidbody Body => body;
public MonoBehaviour Interaction => interaction;
@@ -91,6 +93,12 @@ namespace NBF
public void SetLenght(float lenght)
{
if (!_joint) return;
if (!Mathf.Approximately(lenght, _joint.linearLimit.limit))
{
_joint.linearLimit = new SoftJointLimit() { limit = lenght };
_rope.SetTargetLength(lenght - 0.1f);
}
}
#endregion