41 lines
921 B
C#
41 lines
921 B
C#
using UnityEngine;
|
|
|
|
namespace NBF
|
|
{
|
|
public class LureController : MonoBehaviour
|
|
{
|
|
[SerializeField] private Rigidbody rBody;
|
|
[SerializeField] private ConfigurableJoint joint;
|
|
public Rigidbody RBody => rBody;
|
|
|
|
public ConfigurableJoint Joint => joint;
|
|
|
|
public void SetJoint(Rigidbody rb)
|
|
{
|
|
joint.connectedBody = rb;
|
|
}
|
|
|
|
public void EnableCollision(bool enable)
|
|
{
|
|
if (rBody == null)
|
|
{
|
|
rBody = GetComponent<Rigidbody>();
|
|
}
|
|
|
|
rBody.detectCollisions = enable;
|
|
}
|
|
|
|
public void SetKinematic(bool value)
|
|
{
|
|
rBody.isKinematic = value;
|
|
}
|
|
|
|
public void SetJointDistance(float limit)
|
|
{
|
|
joint.linearLimit = new SoftJointLimit
|
|
{
|
|
limit = limit
|
|
};
|
|
}
|
|
}
|
|
} |