修改绳的逻辑
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user