cocos2d-x中使用box2d时的PTM_RATIO
来源:互联网 发布:js模块化的好处 编辑:程序博客网 时间:2024/06/07 00:36
cocos2d-x中使用box2d时的PTM_RATIO定义成多少和box2d本身的特性有关。别人已经解释的很清楚了:
http://www.raywenderlich.com/28602/intro-to-box2d-with-cocos2d-2-x-tutorial-bouncing-balls
以下是其中重点部分的摘录:
#define PTM_RATIO 32.0
This is defining a ratio of pixels to “meters”. When you specify where bodies are in Cocos2D, you give it a set of units. Although you may consider using pixels, that would be a mistake. According to the Box2D manual, Box2D has been optimized to deal with units as small as 0.1 and as big as 10. So as far as length goes people generally tend to treat it as “meters” so 0.1 would be about teacup size and 10 would be about box size.
So we don’t want to pass pixels in, because even small objects would be 60×60 pixels, way bigger than the values Box2D has been optimized for. So we need to have a way to convert pixels to “meters”, hence we can just define a ratio like the above. So if we had a 64 pixel object, we could divide it by PTM_RATIO to get 2 “meters” that Box2D can deal with for physics simulation purposes.
- cocos2d-x中使用box2d时的PTM_RATIO
- Box2D 的 PTM_RATIO
- Box2D 的 PTM_RATIO
- Box2D 的 PTM_RATIO
- cocos2d-x中使用box2d物理引擎时,开启debugDraw的方法
- cocos2d-x中box2d的关节
- Cocos2d-X Box2D的使用实例
- cocos2d中使用box2d
- cocos2d-x中使用DebugDraw提高box2d开发效率
- 实例介绍Cocos2d-x中Box2D物理引擎:使用关节
- 实例介绍Cocos2d-x中Box2D物理引擎:使用关节
- Cocos2d-X Box2D的基本知识
- cocos2d-x 中box2d的简单使用,代码来自传智播客c++课程 。
- cocos2d-x中使用box2d出现无法解析的外部符。。
- Cocos2d-x中Box2d示例无法运行的问题
- Cocos2d-x Box2d中实现刚体的移动
- cocos2d-x 使用Box2d制作的台球游戏
- 【cocos2d-x】 Box2d的使用----弹球小例子
- Apache虚拟目录设置
- TCP/IP网络协议(转)
- TCP(转)
- 字串数_hdu_1261(大数极致).java
- ICMP(转)
- cocos2d-x中使用box2d时的PTM_RATIO
- C++必知必会之(1)数据抽象
- js arguments对象的用法
- ip协议(转)
- maven项目手动部署到tomcat时jar包异常
- ARP协议(转)
- Using the Runtime APIs
- 以太网(802.3)帧结构 (转)
- C++必知必会之(2)多态