Jump to content

[SOLVED] Crash with 'NodeDummy external not a user class' error


photo

Recommended Posts

Hi all,

 

I have a simple level with one Terrorist AI and a NodeDummy node to move towards already placed on a plane. While running the code, I've been getting a unigine crash with 'NodeDummy external not a user class' error.

 

Please find a simplified version of code attached. Hoping for a quick reply. Thanks in advance!

code.txt

Link to comment

I think the code needs some explanation.

 

I'm trying to implement a simple path creation using NodeDummy objects. There are 3 classes : 1. Map marker (contains NodeDummy instance), 2. Path point derived from Map marker, 3. Terrorist AI that moves towards the path point.

 

Below is the code :

 

1. Map Marker class

// map_marker.h
// ------------

class MapMarker {

    NodeDummy m_cNode;

    MapMarker( NodeDummy a_Node ) {    
        m_cNode = a_Node;
    }

};

2. Path Point class

// ai_path_point.h
// ---------------

namespace AIMarker {
class AIPathPoint : MapMarker {

    AIPathPoint( NodeDummy a_Node ) : MapMarker( a_Node ) {
    
    }

    Vec3 getWorldPosition() {

        return m_cNode.getWorldPosition();
    }

};
};

3. AI Terrorist class.

// ai.terrorist.h
// --------------

namespace  AIEntity {

class AITerrorist : AIHuman {

    AIMarker::AIPathPoint m_cPathPoint;

    AITerrorist( ObjectMeshSkinned a_Mesh ) : AIHuman( a_Mesh ) {
        Property property = m_cBody.getProperty();
        int id = property.findParameter( "path_point" );

        if( id != -1 ) {
            string nodeName = property.getParameterString( id );

            int nodeID = engine.editor.findNode( nodeName );

            if( nodeID != -1 ) {

                Node node = engine.editor.getNode( nodeID );
                if( node != NULL ) {
                    node = node_cast( node );
                    if( is_base_class( "NodeDummy", node ) == 1 ) {
                        m_cPathPoint = node;
                    }
                }
            }
        }
    }

    void flush() {
        if( m_bShouldPatrol && m_cPathPoint != NULL ) {
        moveTowardsPathPoint();
        }
    }

    void moveTowardsPathPoint() {
    
        if( route == NULL ) {
            route = new PathRoute( 2.0f );
        }
    
        route.create2D( m_cBody.getWorldPosition(), m_cPathPoint.getWorldPosition() );
        // do transform code here..
    }

};
};

Basically I'm creating an AITerrorist class instance and assigning an ObjectMeshSkinned node placed on map to its 'm_cBody' variable. Similarly I'm assigning a NodeDummy node placed on the map to its 'm_cPathPoint' variable. While trying to create a 2D path the program crashes at the red marked line, right when calling m_cPathPoint.getWorldPosition().

 

 

 

Link to comment

What is the exact error message on console ? If none: are you running engine debug version main_x86/64d.exe for getting some error hint ? Are you sure that m_cPathPoint is non-null (your initialization code has no error testing for this) ? Have you used step-debugging to verify proper variable initialization ?

 

Please always provide engine log.html file from bin directory on crash.

Link to comment

Thanks for the reply. Please find the log file attached. I've done step-debugging, all variables are being initialized. MoveTowardsPathPoint() is called only after null check on m_cPathPoint. Same case with m_cBody, that's checked too outside the code I've posted here. The crash occurs right when stepping to m_cPathPoint.getWorldPosition().

log.htm

Link to comment

Hi,

 

Thanks for the log file and sample code!

 

Could you please provide us simple test scene (with cpp and world files) for reproduction? This will surely help us to find the root of the issue faster. 

 

And I can see from the log file that you are using July SDK. Do you observe this crash in the latest SDK (August)? 

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment

No problem, Silent. No haven't checked it on the August SDK yet. I've uploaded the necessary cpp and map files. Try adding these to a scratch project, this should reproduce the crash. Let me know if I've missed anything! Thanks.

TestCase.rar

Link to comment
×
×
  • Create New...