About the Vector2Int coordinates

Good morning everyone!

So far I am having fun learning from Gary (who is clearly a mathematics wizard), although I had to slow my pace to a crawl to understand everything, for example the coordinate system:

In the Node script, the Vector2Int coordinates are made of x and y. On this particular grid, I thought we were using x and z.
Is it because we previously defined our y like below? Because I didn’t think the CoordinateLabeler and the Node script were speaking to each other, or at least not just yet.

Hi,

That’s an interesting question. Usually, the parameters of 2D coordinates are named x and y, not x and z. I think this is what Gary wanted to do in his project, too. We use the Vector2Int object to store two values.

However, we are working in Unity’s scene, and the axis pointing “into” out screen is the z-axis. That’s why we have to get the respective values from position.x, move.x, position.z and move.z.

The values themselves are meaningless without context, so Gary’s decision to use x and y for the coordinates does not affect our game in any way. He could have used x and z to store the data.

Is this what you wanted to know? :slight_smile:

Thank you for the swift response. The context you refered to, is it that since our tiles are spread through x and z, the “system” understands that a value y is a substitute for z ?
Or is it me overcomplicating things?

We do not use the coodinates variable for Unity but for creating a new string. See the last line in your screenshot. We get the values which are stored in coordinates. Whether the single components of the Vector2Int objects are called x and y or blah and abc does not matter.

So y is just a label then. Understood thank you I can finally move on! Was stuck for hours…

Exactly. We use x and y in coordinates to generate our label. :slight_smile:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms