I am trying to move an object 0.32 units in Unity, and I need it to be exactly 0.32 to work with the rest of the system. When I run it, it seems fine, but when I look at all the instances of what I am placing some of them are x = 0.64, y = 0.959999999 etc... it breaks my system pretty much every time I run it. Is there any way I can be for certain that it will move the number of units I give it?
private void Move()
{
int i = Choose.Pick(4);
int dir = i;
if (dir == 0)
{
transform.Translate(new Vector3(0.32f, 0, 0));
}
else if (dir == 1)
{
//transform.position += Vector3.down * 0.32f;
transform.Translate(new Vector3(0, -0.32f, 0));
}
else if (dir == 2)
{
//transform.position += Vector3.left * 0.32f;
transform.Translate(new Vector3(-0.32f, 0, 0));
}
else
{
//transform.position += Vector3.up * 0.32f;
transform.Translate(new Vector3(0, 0.32f, 0));
}
PlaceFloor(transform.position);
}