Jump to content

Unigine::Object::getBodyRigid always returns NULL?


photo

Recommended Posts

Posted

We are having some trouble with the Unigine::Object::getBodyRigid function in the C++ API in 2.2.1, it always seems to return NULL even if there is a valid body. Seems like in UniginePhysics.cpp the condition is inverted, returning a BodyRigidInterface when input is NULL and returning NULL when input is a valid BodyRigid:

BodyRigidPtr api(::BodyRigid *arg) { return BodyRigidPtr(arg == NULL ? new BodyRigidInterface(arg) : NULL ); }
Posted

Hi Michiel,

 

Yes, you are absolutely right. Currently there is a wrong condition inside UniginePhysics.cpp (already fixed in our internal builds). You can revert the condition and rebuild the engine to fix this issue.

 

Sorry for the inconvenience caused.

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

  • 2 months later...
Posted

In the same file, there are 2 getters that do not have the 'arg != NULL' test :

BodyPtr api(const ::Body *arg) { return BodyPtr(new BodyInterface(const_cast< ::Body* >(arg))); }
BodyRigidPtr api(const ::BodyRigid *arg) { return BodyRigidPtr(new BodyRigidInterface(const_cast< ::BodyRigid* >(arg))); }

When arg is NULL, we still receive a valid Interface, which will crash at the first function call.

This is just to be sure it will also be fixed in the next release.

×
×
  • Create New...