Please code, i cant find way.
I guess I’m not sure what you’re asking. Are you asking how to remove the fractional part of floating point value?
float x_float = 20.6f;
int x_int = (int)Mathf.Floor(x_float); // x_int == 20
If you want to snap a gameobject’s position to the nearest integer coordinates…
Vector3 a = myGameObject.transform.position;
Vector3 b = new Vector3(Mathf.Floor(a.x), Mathf.Floor(a.y), Mathf.Floor(a.z));
myGameObject.transform.position = b;
Is that what you’re asking?
Found, but its long way
MyVector3=MyGameobject.transform.position;
x1=MyVector3.x;
y1=MyVector3.y;
z1=MyVector3.z;
x2=(int)x1;
y2=(int)y1;
z2=(int)z1;
x1=x2-x1;
y1=y2-y1;
z1=z2-z1;
MuGameObject.transform.Translate(x1,y1,z1);
Say method shorter, who nows, please.
Brian Stone thank u