Lot of cubes problem

Software: Away3D 4.x

Rayen123, Member
Posted: 24 November 2011 01:43 PM   Total Posts: 70

Hi, I trying to add lot of cubes (50x50), but it is freezing when I looked to lot of them
( here: http://webmaking.sk/temp/flash/away3D_cube/Away3D_cube2.html ).
When I have 25x25 cubes its fine, without freezing
( here: http://webmaking.sk/temp/flash/away3D_cube/Away3D_cube.html ).

What I am doing wrong ? Please help.
(here is source code: http://webmaking.sk/temp/flash/away3D_cube/Cubes.as.txt )
Thank you. Rayen123 (sorry for my english cheese)

control: look = mouse, movement = WSAD

 

File Attachments
Cubes.as  (File Size: 4KB - Downloads: 317)
   

Qbrain, Member
Posted: 24 November 2011 01:57 PM   Total Posts: 92   [ # 1 ]

i had almost the same issue as you. I imported a model (not cube) and it froze when I was looking at its location, but woulnt show the model.
In my case, it was my textures that were wrong. So I resaved my texture (as a square of 512 x 512, or maybe lower in your case) and gave it another name. Then the model loaded fine without errors.

Strange, but effective. At least for me.

-Q

   

Avatar
Fabrice Closier, Administrator
Posted: 24 November 2011 02:10 PM   Total Posts: 1265   [ # 2 ]

You can do 2 things: make sure you do not use new Cube more than once and resuse original geometry or use Merge class.

   

Rayen123, Member
Posted: 24 November 2011 02:48 PM   Total Posts: 70   [ # 3 ]

and another question how I can set camera view distance ? Thanks

   

Rayen123, Member
Posted: 24 November 2011 03:06 PM   Total Posts: 70   [ # 4 ]
Qbrain - 24 November 2011 01:57 PM

i had almost the same issue as you. I imported a model (not cube) and it froze when I was looking at its location, but woulnt show the model.
In my case, it was my textures that were wrong. So I resaved my texture (as a square of 512 x 512, or maybe lower in your case) and gave it another name. Then the model loaded fine without errors.

Strange, but effective. At least for me.

-Q

Thanks, but not solving my problem :\

   

Rayen123, Member
Posted: 24 November 2011 03:06 PM   Total Posts: 70   [ # 5 ]
Fabrice Closier - 24 November 2011 02:10 PM

You can do 2 things: make sure you do not use new Cube more than once and resuse original geometry or use Merge class.


In constructor I have:
private var cube:Cube;

and in cycle I have:

cube = new Cube(MaterialClay,32,32,32,3,3,3);
cube.x = i * 64;
cube.z = ii * 64;
cube.y = iii * 64;
viewport.scene.addChild(cube);

so, please help, how I can do “make sure you do not use new Cube more than once and resuse original geometry” ? Thanks,

   

Avatar
80prozent, Sr. Member
Posted: 24 November 2011 09:54 PM   Total Posts: 430   [ # 6 ]

hi

i am not shure, but i think a save way to reuse geometry for cubes would be to build one cube as you are doing right now and than build the other cubes like this:

var originalCube:Cube=new Cube();
var newCube:Mesh=new Mesh();
newCube.geometry=originalCube.geometry;
newCube.material=originalCube.material;

there is a clone method for cube too, but i dont know if it will give you back a complete new cube, or if it gives you back a cube, thats using the same geomerty as the original one.


hope that helps

80

 

 

 Signature 

sorry…i hope my actionscript is better than my english…

   

Rayen123, Member
Posted: 25 November 2011 12:00 AM   Total Posts: 70   [ # 7 ]
80prozent - 24 November 2011 09:54 PM

hi

i am not shure, but i think a save way to reuse geometry for cubes would be to build one cube as you are doing right now and than build the other cubes like this:

var originalCube:Cube=new Cube();
var newCube:Mesh=new Mesh();
newCube.geometry=originalCube.geometry;
newCube.material=originalCube.material;

there is a clone method for cube too, but i dont know if it will give you back a complete new cube, or if it gives you back a cube, thats using the same geomerty as the original one.


hope that helps

80

 

Thanks a lot ! Its not freezing now, but it has low fps, but its normal i guess.

newCube.geometry
it is only for reading, this is solution:
newCube=new Mesh(originalCube.material,originalCube.geometry);

   

Rayen123, Member
Posted: 25 November 2011 12:37 AM   Total Posts: 70   [ # 8 ]

Is it possible not to render cubes, which are not currently visible (some other cubes are in front of them)?

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X