Vector 3 Arrays

Hi all! I’m trying to create a waypoint system for my enemy without really setting up waypoints like most people do it. I’m trying to have it where I have an array of Vectors that the enemy will follow a path to. I’m also trying to visually display the waypoints as well, however when I change the vector numbers in the inspector, the gizmo does not move. Can someone tell me what I’m doing wrong? Is what I’m doing even going to work?
Thanks for any and all help! :slight_smile:

var waypoints                    : Vector3[];

function OnDrawGizmosSelected    (){
    for(var patrol in waypoints){
        Gizmos.color = Color.cyan;
        Gizmos.DrawWireSphere(transform.position,1);
    }
}

Your gizmo doesn’t draw the vector, your gizmo draws the position of the GameObject on which the component is attached that has the waypoint vectors stored in it.

So how can I make the gizmo draw the position of the vector?

instead of passing ‘transform.position’ into the DrawWireSphere. Pass the position of the waypoint (i.e. the vector).

I mean syntax wise, because what I’ve been typing in so far hasn’t worked…

Gizmos.DrawWireSphere(patrol, 1);

See how I passed ‘patrol’ into ‘DrawWireSphere’ instead of ‘transform.position’.

‘transform.position’ is the position of the transform of the GameObject.

‘patrol’ is the name you gave the variable that you use to loop over the array of vectors.

You should probably take some time to learn what variables are, and what parameters are, and how they work.

I have a pretty good understanding of what variables and parameters are, I just need a little bit of help with this. And I already tried this solution before hand and it does not work. Thank you for your help and have a great day.

If you don’t know the syntax to change from passing ‘transform.position’ as a parameter to using the vector you’ve looped over. You don’t have a complete grasp on variables and parameters.

To say otherwise is to hold up your math quiz with an F on it and say you understand math. You failed the quiz, it has been demonstrated you do not.

I’m not trying to be mean here. I’m just stating the fact of the matter.

I said ‘pretty good’ understanding. Enough to get my enemy up and running. Never did I state I had a complete grasp. And you yourself gave me a solution that does not work and you tell me that I don’t have a complete grasp on the concept?

In any case, I’ve SOLVED it. Thank you for your help, and have a wonderful day.

Are you going to let others know how you solved it?

In case someone bothers to happen across this thread?

sigh
Only if you forgive me for all that I’ve said…it turns out that it did worked. It just didn’t draw on top of the enemy like I thought it would, but in the center of the world. I guess we were both right…sorry dude…

that ougta teach you to not be so dismissive and bite the hand that fed ya :roll_eyes: