eugene.litvinov Posted April 22, 2011 Posted April 22, 2011 I set Body::setContactCallback() to determine surface, that is collided with physical body. I use next callback: void eventBodyContactGlobal(Body body, int contact) { Object object1 = body.getObject(); Object object2 = body.getContactObject(contact); Property prop1 = object1.getProperty(); // I need get properties of physical object int surfaceIndex = body.getContactSurface(contact); if (object2 != NULL && surfaceIndex < object2.getNumSurfaces()) { Property prop2 = object2.getProperty(surfaceIndex); // I need get properties of collided object (it's surface's properties) } } This implementation crash Unigine. What I doing wrong?
ulf.schroeter Posted April 22, 2011 Posted April 22, 2011 This implementation crash Unigine. What I doing wrong? Just an idea: also check surfaceIndex returned by body.getContactSurface(contact) for negativ value. If this is the case, this might be the cause for the crash due to invalid array access on following object2.getProperty(surfaceIndex) call.
Recommended Posts