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
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,
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
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)?