esger.abbink_ Posted August 15, 2012 Share Posted August 15, 2012 Hi, suppose I have: NodePtr node ; ObjectMeshDynamicPtr mesh ; how does one go about doing the following? 1. node = mesh ; 2. ((ObjectMeshDynamicPtr) node)->some_mesh_function () ; (where it is known that node is really a mesh, see 1.) Just trying operator= or regular casting creates interesting errors, so looked around a bit and found that the Ptr template does have a .get() function to return a Type*, but not a corresponding .set() (that could be given a regular casted c++ pointer) Any way to do this, or impossible? Link to comment
frustum Posted August 15, 2012 Share Posted August 15, 2012 NodePtr node; ObjectMeshDynamicPtr mesh = ObjectMeshDynamic::create(node); mesh->some_mesh_function(); Link to comment
esger.abbink_ Posted August 16, 2012 Author Share Posted August 16, 2012 NodePtr node; ObjectMeshDynamicPtr mesh = ObjectMeshDynamic::create(node); mesh->some_mesh_function(); that works (or at least compiles) going from NodePtr to ObjectMeshDynamicPtr, but not the other way around. ie. assigning a NodePtr a ObjectMeshDynamicPtr: NodePtr node ; // uninitialised ObjectMeshDynamicPtr mesh ; // references created mesh object node = mesh ; or node = Node::create (mesh) ; The Node class does not seem to have that create() member Link to comment
esger.abbink_ Posted August 19, 2012 Author Share Posted August 19, 2012 Solved it for now by querying a script function to return a NodePtr when given the node ID of the mesh. Still curious though if it's (im)possible to do it on the C++ side? Link to comment
frustum Posted August 23, 2012 Share Posted August 23, 2012 The Unigine::World::getNode(int id) function will be available in the next SDK in C++ API. It returns NodePtr. Link to comment
Recommended Posts