BUD*_*Ax2 0 box2d cocos2d-iphone box2d-iphone
我正在尝试更改文件
GameConfig.h:
#define GAME_AUTOROTATION kGameAutorotationNone
Run Code Online (Sandbox Code Playgroud)
和App代表:
//#if GAME_AUTOROTATION == kGameAutorotationUIViewController
[director setDeviceOrientation:kCCDeviceOrientationPortrait];
//#else
//[director setDeviceOrientation:kCCDeviceOrientationLandscapeLeft];
//#endif
Run Code Online (Sandbox Code Playgroud)
应用程序转为纵向模式,但Box2d机构强制重力向右
小智 5
如果有人需要我意识到这是一个老话题,但如果有人在将来遇到这个问题,这是我的解决方案:
在HelloWorldLayer.mm的加速度计功能中,使用此线设置重力
b2Vec2 gravity( -accelY * 10, accelX * 10);
Run Code Online (Sandbox Code Playgroud)
为了在纵向模式下模拟所需效果,必须将该行重新排序为:
b2Vec2 gravity( accelX * 10, accelY * 10);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1756 次 |
| 最近记录: |