Hi all,
When I make a call to h3dAddGroupNode when I want to make an "Anchor" node for my camera to pivot around, eg.
Code:
_anchor = h3dAddGroupNode( H3DRootNode, "Anchor" );
(Where _anchor is just a H3DNode member in my class) I get an EXC_BAD_ACCESS while I'm porting to iOS. Afaik this is due to accessing an object which doesn't exist or has been removed from the stack or an object access which isn't expected, some confusing stuff for a novice C++ programmer like me
![Smile :)](./images/smilies/icon_smile.gif)
but it seems to only affect iOS as my port to the N900 didn't encounter any issues like this. Also a call to h3dAddCameraNode doesn't seem to have any issues. The exact offending call is here in egMain.cpp:
Code:
DLLEXP NodeHandle h3dAddGroupNode( NodeHandle parent, const char *name )
{
SceneNode *parentNode = Modules::sceneMan().resolveNodeHandle( parent );
APIFUNC_VALIDATE_NODE( parentNode, "h3dAddGroupNode", 0 );
//Modules::log().writeInfo( "Adding Group node '%s'", safeStr( name ).c_str() );
GroupNodeTpl tpl( safeStr( name, 0 ) );
SceneNode *sn = Modules::sceneMan().findType( SceneNodeTypes::Group )->factoryFunc( tpl ); //<-- this call right here gives off an EXC_BAD_ACCESS
return Modules::sceneMan().addNode( sn, *parentNode );
}
My naive problem solving tells me it is because of the casting from a SceneNodeTpl to a GroupNodeTpl on a const? In here:
Code:
SceneNode *GroupNode::factoryFunc( const SceneNodeTpl &nodeTpl )
{
if( nodeTpl.type != SceneNodeTypes::Group ) return 0x0;
return new GroupNode( *(GroupNodeTpl *)&nodeTpl ); //<-- right here
}
This might be just specific for iOS but I think it might be an issue in the long run for the desktop builds, I'm curious now if the OS X port has this issue when adding a group node... If this is a trivial problem on my part I apologise but I thought I might as well post about it, thanks!