I don't know how 3D engines work, but you could try doing something like this only with Z coordinate stuff: IF EX<X THEN X=X+1 (and so on and so forth)