my array has a length of zero even though length is set to 20 and I update segment pose in the start function.
public class Tentacle : MonoBehaviour
{
public int length = 20;
public LineRenderer lineRend;
public Vector3[] segmentPose;
public Transform targetDir;
public float targetDist;
private Vector3[] segment5;
public float smoothSpeed;
private void start()
{
lineRend.positionCount = length;
segmentPose = new Vector3[length];
segment5 = new Vector3[length];
}
// Update is called once per frame
private void Update()
{
Debug.Log(segmentPose.Length);
segmentPose[0] = targetDir.position;
for (int i = 1; i < segmentPose.Length; i++)
{
segmentPose <em>= Vector3.SmoothDamp(segmentPose_, segmentPose[i-1] + targetDir.right * targetDist, ref segment5*, smoothSpeed);*_</em>
}
lineRend.SetPositions(segmentPose);
}
}
debug says it still has 0 length ,My array length is stuck at zero and wont change, what am I doing wrong
my length int is set 20
segmentPose = new Vector3[length];
this code is in my start function