PhysicsEditor-Cocos2d-x-Box2d icon indicating copy to clipboard operation
PhysicsEditor-Cocos2d-x-Box2d copied to clipboard

cocos2d-x plist loader doesn't load the fixture Ids defined in Physics Editor

Open darbotron opened this issue 10 years ago • 0 comments

I'm reporting this, but as it happens I have also fixed it.

The root of the bug is in GB2ShapeCache::addShapesWithFile() where the code doesn't check for the key 'id' which is used to save the Id text from physics editor into the plist.

I say it's the root, since there is a load of redundant code that tries to read a key called "userdataCbValue", it then converts the string to an int and stores the value, but doesn't use it in any way that would allow a user to get at it via the user data pointer of a b2Fixture.

The fix is non-trivial (though not very complicated), and you might not want to put it in as-is because I'm not sure it's 100% in keeping with the way it works - for example - in objective-C.

More than happy to give you the files, but not really familiar with git and don't want to bugger it up (I typically use perforce). Files affected are: GB2ShapeCache-x.h and .cpp

Let me know :)

Alex

darbotron avatar Nov 11 '13 23:11 darbotron