I think your trying to achieve something like this?
The main thing to remember here, is that even though a cube is 1 unit, it's actually 2 wide, 2 high and 2 deep. So, to move a cube like that, you need to move it, twice it's scale. All the stuff for that grid is based on the scale variable. The texture is just a single square. It is scaled:
So it fits the cube properly and doesn't scale along with it. I position the cube using x,y and z co-ords according to the grid scale. 1,1,1 is the bottom left, closest corner. To position the cube:
(scale*2)/-2 + x
scale*2 <<< because a normal unscaled blitz cube, is 2 wide/high/deep.
/2 <<< divide all that by 2, because you taking the positioning from the middle of the cube. IN theory, the *2 and /2 cancel each other out, but it's good to see whats happening.
+x <<< add on the co-ords to offset the cube to it's place inside the grid.
I hope that helps and i hope it's what your after :o)
Graphics3D 800,600 SetBuffer BackBuffer() Global camera = CreateCamera() Global grid = CreateCube() Global gridtext=CreateTexture(256,256,2) SetBuffer TextureBuffer(gridtext) Color 180,180,180 Rect 0,0,256,256,0 Rect 1,1,254,254,0 Rect 2,2,252,252,0 SetBuffer BackBuffer() EntityTexture grid, gridtext EntityFX grid,16 Global scale# = 5 PositionEntity camera,0,0,-scale*3.2 ScaleEntity grid, scale, scale, scale ScaleTexture gridtext,1.0/scale,1.0/scale EntityAlpha grid,0.3 Global selector = CreateCube() EntityAlpha selector,0.7 PositionEntity selector,(scale*2)/-2 + 1,(scale*2)/-2 + 1,(scale*2)/-2 + 1 Global x% = 1,y% = 1,z% = 1 While Not KeyHit(1) If KeyHit(203) Then x = x - 2: If x < 1 Then x = 1 If KeyHit(205) Then x = x + 2: If x > (scale*2) Then x = x - 2 If KeyHit(200) Then y = y + 2: If y > (scale*2) Then y = y - 2 If KeyHit(208) Then y = y - 2: If y < 1 Then y = 1 If KeyHit(30) Then z = z + 2: If z > (scale*2) Then z = z - 2 If KeyHit(44) Then z = z - 2: If z < 1 Then z = 1 PositionEntity selector,(scale*2)/-2 + x,(scale*2)/-2 + y,(scale*2)/-2 + z UpdateWorld RenderWorld Flip Wend End
The main thing to remember here, is that even though a cube is 1 unit, it's actually 2 wide, 2 high and 2 deep. So, to move a cube like that, you need to move it, twice it's scale. All the stuff for that grid is based on the scale variable. The texture is just a single square. It is scaled:
scaletexture texture,1/scale,1/scale
So it fits the cube properly and doesn't scale along with it. I position the cube using x,y and z co-ords according to the grid scale. 1,1,1 is the bottom left, closest corner. To position the cube:
PositionEntity selector,(scale*2)/-2 + x,(scale*2)/-2 + y,(scale*2)/-2 + z
(scale*2)/-2 + x
scale*2 <<< because a normal unscaled blitz cube, is 2 wide/high/deep.
/2 <<< divide all that by 2, because you taking the positioning from the middle of the cube. IN theory, the *2 and /2 cancel each other out, but it's good to see whats happening.
+x <<< add on the co-ords to offset the cube to it's place inside the grid.
I hope that helps and i hope it's what your after :o)