37 lines
752 B
C#
37 lines
752 B
C#
using UnityEngine;
|
|
|
|
public class RopeAdditionalParams : MonoBehaviour
|
|
{
|
|
public bool updateOnStart;
|
|
|
|
public float nodeMass = 1f;
|
|
|
|
public float nodeDrag = 1f;
|
|
|
|
public float nodeAngularDrag = 1f;
|
|
|
|
private void Start()
|
|
{
|
|
if (updateOnStart)
|
|
{
|
|
UpdateNodes(GetComponent<UltimateRope>());
|
|
}
|
|
}
|
|
|
|
public void UpdateNodes(UltimateRope rope)
|
|
{
|
|
for (int i = 0; i < rope.RopeNodes.Count; i++)
|
|
{
|
|
UltimateRope.RopeNode ropeNode = rope.RopeNodes[i];
|
|
GameObject[] segmentLinks = ropeNode.segmentLinks;
|
|
foreach (GameObject gameObject in segmentLinks)
|
|
{
|
|
Rigidbody component = gameObject.GetComponent<Rigidbody>();
|
|
component.mass = nodeMass;
|
|
component.drag = nodeDrag;
|
|
component.angularDrag = nodeAngularDrag;
|
|
}
|
|
}
|
|
}
|
|
}
|