Jump to content

ObjecMeshDynamic clone()


photo

Recommended Posts

Posted

we want to have 2 exact same dynamic meshes but with different materials.

 

In our existing code we have a wrapper around ObjectMeshDynamic like

namespace MeshUtils
{
class DynamicMesh : ObjectMeshDynamic
{
    /// Construct & set material in one
    DynamicMesh( string materialName ) : ObjectMeshDynamic()
    {
        setMaterial( "materialName", "*" );
        setProperty("surface_base","*");
    }
.......

then we have 2 objects:

MeshUtils::DynamicMesh mesh1 = new MeshUtils::DynamicMesh("material_1");
ObjectMeshDynamic mesh2 = new ObjectMeshDynamic();
 

And With Unigine 1 we were able to clone one to another using

mesh2 = mesh1.clone();
mesh2.setMaterial( "material_2", "*" ); 

In Unigine 2.3.1 its giving error

 

mesh2.setMaterial( "material_2", "*" );

ExternClass::run_function(): can't find "class ObjectMeshDynamic * __ptr64" base class in "class Node * __ptr64" class

Posted

Hi Priyank,

 

Try to use

mesh2 = node_cast(mesh1.clone());

instead of

mesh2 = mesh1.clone();
Posted

Yes that worked.

 

Can you please describe it a bit to help us understand the internals.

 

 

Thanks.

×
×
  • Create New...