Skip to main content
added 125 characters in body
Source Link
Demandooda
  • 125
  • 3
  • 13

I want to have one square that rests at the Unity 2d coordinates (5,5). Using transform.localScale I make the square be 3 units by 3 units large. So I thought that if I made another square that is the exact same except it is at the coordinate (8,5), the second square would be directly to the right of the first one, touching it. But instead, the square spawns a bit more to the right than it should, implying that the size x,y units are smaller than the position x,y units. Any way I can solve this problem, and have both touching? Thank you.

Code for placing the squares (tileHeight = 3 and tileWidth = 3):

GrassTile.transform.localScale = new Vector3(tileWidth, tileHeight, 0f);
Instantiate (GrassTile, new Vector3 (0f, 15f, 0f), Quaternion.identity);
Instantiate (GrassTile, new Vector3 (3f, 15f, 0f), Quaternion.identity);

Screenshot of what it looks like, as well as what the prefab looks like: Unity inspector of what game looks like.

Screen shot of the grassTile stats: enter image description here

I want to have one square that rests at the Unity 2d coordinates (5,5). Using transform.localScale I make the square be 3 units by 3 units large. So I thought that if I made another square that is the exact same except it is at the coordinate (8,5), the second square would be directly to the right of the first one, touching it. But instead, the square spawns a bit more to the right than it should, implying that the size x,y units are smaller than the position x,y units. Any way I can solve this problem, and have both touching? Thank you.

Code for placing the squares (tileHeight = 3 and tileWidth = 3):

GrassTile.transform.localScale = new Vector3(tileWidth, tileHeight, 0f);
Instantiate (GrassTile, new Vector3 (0f, 15f, 0f), Quaternion.identity);
Instantiate (GrassTile, new Vector3 (3f, 15f, 0f), Quaternion.identity);

Screenshot of what it looks like, as well as what the prefab looks like: Unity inspector of what game looks like.

I want to have one square that rests at the Unity 2d coordinates (5,5). Using transform.localScale I make the square be 3 units by 3 units large. So I thought that if I made another square that is the exact same except it is at the coordinate (8,5), the second square would be directly to the right of the first one, touching it. But instead, the square spawns a bit more to the right than it should, implying that the size x,y units are smaller than the position x,y units. Any way I can solve this problem, and have both touching? Thank you.

Code for placing the squares (tileHeight = 3 and tileWidth = 3):

GrassTile.transform.localScale = new Vector3(tileWidth, tileHeight, 0f);
Instantiate (GrassTile, new Vector3 (0f, 15f, 0f), Quaternion.identity);
Instantiate (GrassTile, new Vector3 (3f, 15f, 0f), Quaternion.identity);

Screenshot of what it looks like, as well as what the prefab looks like: Unity inspector of what game looks like.

Screen shot of the grassTile stats: enter image description here

added 483 characters in body
Source Link
Demandooda
  • 125
  • 3
  • 13

I want to have one square that rests at the Unity 2d coordinates (5,5). Using transform.localScale I make the square be 3 units by 3 units large. So I thought that if I made another square that is the exact same except it is at the coordinate (8,5), the second square would be directly to the right of the first one, touching it. But instead, the square spawns a bit more to the right than it should, implying that the size x,y units are smaller than the position x,y units. Any way I can solve this problem, and have both touching? Thank you.

Code for placing the squares (tileHeight = 3 and tileWidth = 3):

GrassTile.transform.localScale = new Vector3(tileWidth, tileHeight, 0f);
Instantiate (GrassTile, new Vector3 (0f, 15f, 0f), Quaternion.identity);
Instantiate (GrassTile, new Vector3 (3f, 15f, 0f), Quaternion.identity);

Screenshot of what it looks like, as well as what the prefab looks like: Unity inspector of what game looks like.

I want to have one square that rests at the Unity 2d coordinates (5,5). Using transform.localScale I make the square be 3 units by 3 units large. So I thought that if I made another square that is the exact same except it is at the coordinate (8,5), the second square would be directly to the right of the first one, touching it. But instead, the square spawns a bit more to the right than it should, implying that the size x,y units are smaller than the position x,y units. Any way I can solve this problem, and have both touching? Thank you.

I want to have one square that rests at the Unity 2d coordinates (5,5). Using transform.localScale I make the square be 3 units by 3 units large. So I thought that if I made another square that is the exact same except it is at the coordinate (8,5), the second square would be directly to the right of the first one, touching it. But instead, the square spawns a bit more to the right than it should, implying that the size x,y units are smaller than the position x,y units. Any way I can solve this problem, and have both touching? Thank you.

Code for placing the squares (tileHeight = 3 and tileWidth = 3):

GrassTile.transform.localScale = new Vector3(tileWidth, tileHeight, 0f);
Instantiate (GrassTile, new Vector3 (0f, 15f, 0f), Quaternion.identity);
Instantiate (GrassTile, new Vector3 (3f, 15f, 0f), Quaternion.identity);

Screenshot of what it looks like, as well as what the prefab looks like: Unity inspector of what game looks like.

edited tags
Link
Demandooda
  • 125
  • 3
  • 13
Source Link
Demandooda
  • 125
  • 3
  • 13
Loading