Initiate object along GameObject path
As you probarly already read by the title, I need to have a prefab placed around a path of gameobjects for a tank track.
I have already tried initiate with lerp, but that didn't really help me out.
Below is all the code, inspector values and more information:
DrawLineBO:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DrawLineBO : MonoBehaviour
{
public GameObject[] Points;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
void OnDrawGizmos()
{
Gizmos.DrawLine(Points[0].transform.position, Points[1].transform.position);
Gizmos.DrawLine(Points[1].transform.position, Points[2].transform.position);
Gizmos.DrawLine(Points[2].transform.position, Points[3].transform.position);
Gizmos.DrawLine(Points[3].transform.position, Points[4].transform.position);
Gizmos.DrawLine(Points[4].transform.position, Points[5].transform.position);
Gizmos.DrawLine(Points[5].transform.position, Points[0].transform.position);
//Gizmos.DrawLine(Points[6].transform.position, Points[7].transform.position);
}
}
Inspector values:
The script is attached to a Gameobject under the Tank gameobject.
The Gameobjects are placed underneath the parent gameobject (the gameobject the script is attached to)
The scene/project is 3D, just the default 3D Template
Your answer
Follow this Question
Related Questions
How can I draw the past trajectory of a GameObject which it has completed since the game started? 1 Answer
Screen to World Position: Can't seem to get it right 0 Answers
Is there a way to allow the user to change the position of the game object in game? 0 Answers
How can I change GameObject's texture? 1 Answer
How to find GameObject in script? 1 Answer