Hi,
I'm trying to build procedural geometry from C# in 3.0RC1. I was using SurfaceTool but believe that it might be rather slow for what I'm trying to achieve (a call out every vertex addition), so I'm looking at directly creating the vertex, index etc arrays myself and using Mesh.AddSurfaceFromArrays() instead.
I'm running into confusion around the types of array I should be using. The C# Mesh.AddSurfaceFromArrays() method signature expects an object[] as the 'arrays' parameter, in order that each array contained in it can contain different types (Vector3, int, etc). So I've defined my object[] and it contains a verticesArray as object[] also and that's ok.
However at runtime I get the following error:
Condition ' parrays[ai].gettype() != Variant::POOLVECTOR3ARRAY ' is true. returned: ERRINVALIDPARAMETER
...
C Source: servers\visualserver.cpp:429
C Function: VisualServer::surfacesetdata
This looks like it's wanting an array of type PoolVector3Array instead of an object[]. And I can't find any definition of this for C#. I have come across this link in the docs:
http://docs.godotengine.org/en/latest/learning/scripting/c_sharp/c_sharp_differences.html#array
which seems to imply that the implementation isn't finished yet for Array etc?
Where am I going wrong, or is it non-functional from C# at the moment? Should my verticesArray be of type Vector3[] instead of object[]? But then I have trouble assigning it "into" the object[] 'arrays' variable as it won't cast from Vector3[] to object[]. Confusion!