Mesh constructor

Software: Other

Tayyab, Member
Posted: 19 July 2012 05:00 AM   Total Posts: 72
var recieverMesh:Mesh = new Mesh(); 

when trying to create an empty receiver mesh i get this error:

Incorrect number of arguments.  Expected 1.

I am porting my code from away3d 4 Beta to Gold. Worked fine on the beta version.

 

   

Richard Olsson, Administrator
Posted: 19 July 2012 08:20 AM   Total Posts: 1192   [ # 1 ]

I moved your post to a separate thread since it’s completely unrelated to the thread that you had replied to.

What you’re experiencing is the new compulsory geometry argument to the Mesh constructor. This was changed because a mesh with no geometry is an invalid state that could cause errors on render. By making it non-mandatory (having a default value of null) we were implying that it was ok not to set the geometry, which is a lie. It could cause errors, and should not be encouraged.

For that reason, we decided to make it mandatory, and now that it is, you need to pass in something to that argument. It could be a new Geometry instance, or it could of course still be null.

If you pass in null, you will need to set the geometry using the Mesh.geometry setter later.

   

Tayyab, Member
Posted: 19 July 2012 09:40 AM   Total Posts: 72   [ # 2 ]

Thanx a lot for the clarification.

I ended up doing this:

var recieverMesh:Mesh = new Mesh(New geometry); 
   

Richard Olsson, Administrator
Posted: 19 July 2012 09:41 AM   Total Posts: 1192   [ # 3 ]

Yeah, depending on what you do in the rest of your code (e.g. if it assumes that your mesh will have a geometry after having created the mesh) that would be one way of solving it!

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X