michael.zhang Posted August 7, 2011 Share Posted August 7, 2011 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
michael.zhang Posted August 8, 2011 Author Share Posted August 8, 2011 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
ulf.schroeter Posted August 8, 2011 Share Posted August 8, 2011 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
michael.zhang Posted August 8, 2011 Author Share Posted August 8, 2011 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
Recommended Posts