Hello everyone.
I have the following bug in a project. In the constructor of an actor, I create a new instance of a class named mjCModel (third-party library) using the following code.
mjCModel* mc = new mjCModel;
After that I use functions of the class like this one.
mjCGeom* plane = mc->GetWorld()->AddGeom();
plane->type = mjGEOM_PLANE;
plane->size[0] = 20.0;
Inside the code of AddGeom a class of type mjCGeom is created using new operator and then its elements are modified.
There is the following problem. Although the plane it is created when I change its elements (setting for example plane->type) some of the plane’s class elements are changing (and set to large numbers).
The interesting thing is that the exact same code is running perfectly outside Unreal. So, I assume that the overridden new operators of Unreal in some way make the functions of the third-party library using new operator run in a wrong way. Also, I have to mention that the third-party library integration is working in Unreal (the linking is working etc.) so the code runs but it does not run right (the objects are created but inside some elements have wrong values, although outside Unreal, same code, have the right values)
I would like to see your ideas and possible directions on this topic and feel free to ask me for more details.
TL;DR: The same code outside Unreal runs perfectly well but inside an Unreal Actor the construction of the objects (using new operators) is not performing well.