Jump to content

engine.world.saveNodes ObjectDummy gravity flag not saved


photo

Recommended Posts

Hello,

 

I've created a ObjectDummy in my world. I modify the Body parameters, and then save it:

 

int nodes [0];
for(int i = 0; i < engine.editor.getNumNodes(); i++){
	nodes.append(engine.editor.getNode(i));
}
engine.world.saveNodes(levelFile, nodes);

 

When reloaded, all settings in the Body tab are correctly saved/loaded, EXCEPT the gravity flag.

That is, if I have gravity disabled on the Body, then when saved/loaded, the gravity is enabled again.

Link to comment

Thanks, fixed.

 

Great! Is this a bug in the unigine core scripts? If so, can you give me the updated code to copy/paste?

I'd like to be able to use the gravity flag before the next SDK release.

Link to comment

Is this a bug in the unigine core scripts? If so, can you give me the updated code to copy/paste?

 

As frustum is not online yet here is my best guess: most probably the bug is in engine source code engine/physics/bodies/Body.cpp

 

int Body::saveWorld(Xml *xml) const {
...
// gravity flag
if(isGravity() != 0) xml->setBoolArg("gravity",isGravity());
...	

 

should be

 

int Body::saveWorld(Xml *xml) const {
...
// gravity flag
if(isGravity() == 0) xml->setBoolArg("gravity",isGravity());
...	

 

As far as I know (Denis mentioned it in some post) there will be another SDK update quite soon.

Link to comment

Well, I guess I can't fix it if it's a source code problem. I hope that update comes out quite soon.

 

I'm kind of surprised that nobody has discovered this bug already. Nobody has attempted to save a body with gravity flag disabled before?

Link to comment
×
×
  • Create New...