27 lines
625 B
C#
27 lines
625 B
C#
using UnityEngine;
|
|
|
|
namespace NBF
|
|
{
|
|
public class BobberController : MonoBehaviour
|
|
{
|
|
[SerializeField] private Rigidbody _rbody;
|
|
|
|
[SerializeField] private ConfigurableJoint joint;
|
|
|
|
public Rigidbody rbody => _rbody;
|
|
|
|
public void SetJoint(Rigidbody rb)
|
|
{
|
|
joint = joint == null ? GetComponent<ConfigurableJoint>() : joint;
|
|
joint.connectedBody = rb;
|
|
}
|
|
|
|
public void SetJointDistance(float limit)
|
|
{
|
|
joint.linearLimit = new SoftJointLimit
|
|
{
|
|
limit = limit
|
|
};
|
|
}
|
|
}
|
|
} |