浮漂修改

This commit is contained in:
2026-02-27 00:40:45 +08:00
parent 9a92e30a5f
commit fedef338c1
11 changed files with 1268 additions and 175 deletions

View File

@@ -7,7 +7,7 @@ namespace NBF
[SerializeField] private Rigidbody _rbody;
[SerializeField] private ConfigurableJoint joint;
[SerializeField] private Buoyancy _buoyancy;
public Rigidbody rbody => _rbody;
public void SetJoint(Rigidbody rb)
@@ -15,7 +15,7 @@ namespace NBF
joint = joint == null ? GetComponent<ConfigurableJoint>() : joint;
joint.connectedBody = rb;
}
public void SetJointDistance(float limit)
{
joint.linearLimit = new SoftJointLimit
@@ -23,5 +23,16 @@ namespace NBF
limit = limit
};
}
public void SetDetectCollisionEnabled(bool en)
{
_rbody.detectCollisions = en;
_buoyancy.EnablePhysics(en);
}
public void SetVelocity(Vector3 velocity)
{
_rbody.linearVelocity = velocity;
}
}
}