Hey
I’m trying to get a gameObject to move to a start position then move through a list of Vector3s before reaching the end of a path. I’ve got the start and end positions working well, however, I do not know how to get a gameObject to move through the Vector3 list INORDER. I’ve tried getting the positionList to convert to a position, however, nothing seems to be working and I’m not sure how to write a sequence to move to each individual point.
This is the code I’m working with;
-
if (!startPositionIsSet && middlePossitionListIsSet && endPositionIsSet && Mathf.Approximately(gameObject.transform.position.magnitude, startPoint.magnitude))*
-
{*
-
for (int i = 0; i < positionList.Count; i++)*
-
{*
gameObject.transform.position = Vector3.Lerp(gameObject.transform.position, positionList_, 1 / (duration * (Vector3.Distance(gameObject.transform.position, positionList*))));
Debug.Log("I am at " + transform.position + " Moving to position " + positionList);*_