How can i build an array of vector3 positions?
Thanks
How can i build an array of vector3 positions?
Thanks
Javascript
var positions : Vector3[];
or in C#
Vector3[] positions;
Then either populate in manually in the inspector or programmatically.
Example. C#:
Vector3[] positions;
void Start() {
Transform[] players = FindObjectsOfType(typeof(SomeIdentifyingType)) as Transform[];
//Create an array of player objects.
// I haven't found a way of doing this without creating a helper array.
positions = new Vector3[players.Length];
//Recreate the array a different size.
for (int i = 0; i < players.Length; i++) {
positions _= players*.position;*_
_*//add every position into the array.*_
_*}*_
_*}*_
_*//This should be straightforward to put into js.*_
_*```*_
For a built-in (standard) array you build it like any other array:
var myArray : Vector3[] = Vector[5];
myArray[0] = transform.position;