Can’t find the Cube primitive

Software: Away3D 4.x

qutaibah, Newbie
Posted: 23 February 2012 04:08 PM   Total Posts: 2

Hello, I have been trying to migrate my code to away3D 4 beta.

but have been hitting a wall when I try to import the cube primitive.
I go into away3D.primitives (in flash builder 4.6 and in my file directory on my mac). but there is no class for Cube. I can only find the CubeGeometry!

Can someone please help me figure this out,

Thank you very much,

   

inSertCodE, Sr. Member
Posted: 23 February 2012 05:20 PM   Total Posts: 105   [ # 1 ]

You now use primitives to construct your geometry not make an object.

Here is an example for plane but it applies to any primitive.
private var Plane1:Mesh;
Plane1= new Mesh(new PlaneGeometry(1000, 1000, 10, 10), GrassTexture);

   

qutaibah, Newbie
Posted: 23 February 2012 05:36 PM   Total Posts: 2   [ # 2 ]

Thanks a lot for your reply.

So if I wanted to create a simple cube, it would be:

create a mesh using a cube geometry + material (or texture).

Can you refer me to any tutorials on this. All the tutorials I have come across for away3d 4 are using the Cube primitive. Which is really confusing!

Thanks again,

   

Avatar
Fabrice Closier, Administrator
Posted: 23 February 2012 07:54 PM   Total Posts: 1265   [ # 3 ]

The same rule applies to all primitives (and the one that are will be restored in near future) and meshes constructs in general.

new Mesh( new primitiveGeometry(params for this specific geometry), MaterialBase);

where too often loops like this one were unnecessary used.
var i;i<tooManyCubes;++i)
  new Cube();

you can do now one geometry
and then in loop
new Mesh(myUniqueCubeGeometry(), material);

It is of course not the answer for everything. Sometimes you want different objects definitions, merge etc.. But we beleive the choice is more obvious now.

Regarding examples/tutorials. We’re gonna add gradually more of these as we move to final release 4.0.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X