I have a ball and multiple of alligned blocks.
When the ball moves on the blocks, sometimes the ball collides with one of the blocks as you see in the picture.
The ball was moving left to right and when at the joint of two blocks it sometimes bumps.
As if there was a height difference, like a little crack.
This does not happen with all of the joints. It occurs randomly.
The blocks were created and alligned by code so I don’t see why it has a difference in height.
Only thing that I could think of is somewhere in floating points??
Below is the code from the “Block Manager” gameObject where it creates all the blocks.
I would really like to know why this is happening for sure, and a solution would be even greater.
using UnityEngine;
using System.Collections;
public class BlockManagerScript : MonoBehaviour {
public GameObject block;
// Use this for initialization
void Start () {
for (int i = 0; i < 200; i++) {
GameObject blockCopy = Instantiate (block);
blockCopy.transform.SetParent (transform);
Vector3 position = block.transform.position;
position.x += block.GetComponent<SpriteRenderer> ().bounds.size.x * (i + 1);
blockCopy.transform.position = position;
}
}
// Update is called once per frame
void Update () {
}
}