http://www.cocos2d-iphone.org/forum/topic/841
Riq Quesada from Cocos2D asked for a sample app, and I just posted one for him. I used the Bullet 2.74 source and tried to follow your examples but not sure if I found the best way to do things. If you have time, would you mind reviewing for us:
http://www.playngive.com/bulletCocos2D.zip
http://www.playngive.com/cocos2d.zip
Some questions:
- For these static world spaces, isn't there a better way to set up the AABB; I use four cubes to define the outer bounds -- should use 6 I guess, but isn't there a way to create a cube with inverted normals to contain the world more directly?
- You can see from the game the collisions aren't as precise as you'd like; increasing the step size doesn't seem to help however and I wonder if that's an issue with your 2D collision solver?
- I'm missing the math to do this, but one problem with using Bullet in a 2D game is the angular rotation is 3D of course, so when I try to map a sphere's angular rotation to a 2D projection (ie., a disk) it's not smooth; is there something better than the method I'm using:
Code: Select all
btTransform trans = body->getWorldTransform();
btQuaternion rot = trans.getRotation();
[sprite setRotation: (float) CC_RADIANS_TO_DEGREES( rot.z() )];
--yarri