- Home /
Question by
vuqarahim · May 21 at 05:50 AM ·
instantiatespritegridglitchingdisappearing
Sprite edges disappear
I am trying to cover the wall with sprites to make a grid view
Width = transform.localScale.x * 10;
Height = transform.localScale.z * 10;
pivot = Instantiate(new GameObject().gameObject, this.transform).transform;
pivot.localPosition = new Vector3(-5, 0, -5);
int cellCount = Mathf.FloorToInt(transform.localScale.x * transform.localScale.z) * 100;
grid = new Grid(new Cell[cellCount], 1, transform.localScale.x * 10, transform.localScale.z * 10, transform.position, pivot);
if (!debug)
return;
for (int w = 0; w < Width; w++)
{
for (int h = 0; h < Height; h++)
{
Instantiate(sprite, grid.GetWorldPosition(w, h, 0) + new Vector3(1, 1f, -0.2f) * grid.CellSize, Quaternion.LookRotation(transform.up), transform);
}
}
this is the pivot
As I move the player which camera is attached to it, sprite edges starts to disappear.
sprite is a quad with yellow edges and grey in the middle, whole wall should be covered with it, but there are significant gaps as seen.
Any idea why this happens and how to fix? or maybe a better way to achieve a grid view on planes? Thanks.
image-2022-05-21-093625506.png
(57.3 kB)
image-2022-05-21-094013076.png
(105.6 kB)
Comment