Tiles positioning on vertical axis

Software: Away3D 4.x

room101, Newbie
Posted: 22 October 2014 02:01 AM   Total Posts: 14

hi all,

I have an orthographic camera that is positioned using

fov 25;
     
minusZ = (Main.APP_HEIGHT 0.5) / Math.tan((Math.PI 180) * (fov 0.5));
     
minusZHypotenuse Math.sqrt((Main.APP_HEIGHT Main.APP_HEIGHT) + (minusZ minusZ));
     
Main.away3dView.camera.position = new Vector3D(0Main.APP_HEIGHTminusZHypotenuse);
     
Main.away3dView.camera.lookAt(new Vector3D(0,0,0));
     (
Main.away3dView.camera.lens as OrthographicLens).projectionHeight Main.APP_HEIGHT

then I create 16 planes that I want to position in a 4 x 4 grid with the following code

var tilt:Number 2*512*Math.cos(360+Main.away3dView.camera.rotationX);
   
trace("tilt"tilt);
   var 
rows:*=0;
   var 
columns:*;
   var 
increment:*=0;
   while (
rows 4
   
{
    columns 
0;
    while (
columns 4
    
{
     
var bitmap:Bitmap Main.currentMapImagesArray[increment] as Bitmap;
     var 
bitmapData:BitmapData bitmap.bitmapData;
     var 
tile:Mesh = new Mesh(new PlaneGeometry(bitmap.width, -tilt), new TextureMaterial(new BitmapTexture(bitmapData)));
     
     
tile.columns 1024;
     
tile.rows tilt;
     
     
Main.mapTiles.addChild(tile);
     ++
columns;
     ++
increment;
    
}
    
++rows;
   

Then I rotate the grid, so that camera view is perpendicular on the grid

Main.mapTiles.rotati Vector3D(-Main.away3dView.camera.rotationX,-Main.away3dView.camera.rotationY,-Main.away3dView.camera.rotationZ); 

but for some reason the tiles in the grid still have some space in between On the vertical position, horizontally, it looks okay, one cannot see where the tiles are merged together
My goal is to have a big 4096x4096 map made out of 1024x1024 tiles, attached is an example of how it looks like with the space between vertical positioning

Maybe my equations are wrong, maybe on overthinking it, but at this point I can use a fresh perspective( some pun intended)…

if there is a better way to do it, can you point me in the right direction?

Thanks!

 

   

room101, Newbie
Posted: 23 October 2014 12:33 AM   Total Posts: 14   [ # 1 ]

I solved my problem with some math.floor on the tiles formula, and math.ceil on the camera formula, and I simplified the tiles formula as

var angle:Number Main.away3dView.camera.rotationX;
   var  
tiltint Math.floor(512*Math.sin(angle)); 


and that was it. I guess I was very tired last night. grin
Thanks!

   
   
‹‹ AGAL2

X

Away3D Forum

Member Login

Username

Password

Remember_me



X