nathank Posted March 27, 2012 Share Posted March 27, 2012 I have a Node variable that has been loaded via node_load. The node contains a single ObjectMesh (with no body). I want to call Object.setMaterialParameter but casting directly using Object(node) doesn't work because it says Object isn't a base class of Node. In the past I've done this via Body.getObject but this time I don't have a body so I'm stuck.So how can I cast the Node to Object (or ObjectMesh)? Or is there another way to set material parameters on a node that I'm missing? Link to comment
frustum Posted March 27, 2012 Share Posted March 27, 2012 Use node_cast() function from the core/unigine.h file. 1 Link to comment
ivan.cuevas Posted March 27, 2012 Share Posted March 27, 2012 Object object_cast(Node node) { return ((node != NULL) && (node.isObject()))? class_cast("Object",node) : NULL; } Link to comment
nathank Posted March 28, 2012 Author Share Posted March 28, 2012 Thanks guys. Both useful responses. class_cast is the one I was really missing, but node_cast does the job fine in this case. Link to comment
Recommended Posts