Box2D笔记
来源:互联网 发布:电影后期制作软件 编辑:程序博客网 时间:2024/05/16 00:45
所谓质心,可以理解为是Cocos2d-x里面的锚点。
b2Body里面的一些函数试验:
void b2Body::ApplyAngularImpulse(float32 impulse) [inline]Apply an angular impulse.Parameters:impulsethe angular impulse in units of kg*m*m/s
给刚体一个旋转的作用力(围着质心旋转,如果刚体是一个圆那么就是围着圆心转的效果),数字越大转速越快。注意:必须是动态刚体才会有作用,即将刚体定义的type设置为b2_dynamicBody。例子:ballDef.type = b2_dynamicBody;
void b2Body::ApplyForce(const b2Vec2 & force,const b2Vec2 & point ) [inline]Apply a force at a world point. If the force is not applied at the center of mass, it will generate a torque and affect the angular velocity. This wakes up the body.Parameters:forcethe world force vector, usually in Newtons (N).pointthe world position of the point of application.
给予刚体一个力:
参数1:b2Vec2结构体,指示力在x和y轴上的大小。数值越大,动态刚体的移动速度越快(有点类似于每帧在不断更新x和y轴上给予的力的数值的位置信息,匀速的)。
参数2:b2Vec2结构体,作用力的位置(通常是刚体的质心)。
/// Apply a force to the center of mass. This wakes up the body. /// @param force the world force vector, usually in Newtons (N). void ApplyForceToCenter(const b2Vec2& force);
void b2Body::ApplyLinearImpulse(const b2Vec2 & impulse,const b2Vec2 & point ) [inline]Apply an impulse at a point. This immediately modifies the velocity. It also modifies the angular velocity if the point of application is not at the center of mass. This wakes up the body.Parameters:impulsethe world impulse vector, usually in N-seconds or kg-m/s.pointthe world position of the point of application.
给予刚体一个线性冲力:
参数1:b2Vec2结构体,指示力在x和y轴上的大小。数值越大,动态刚体的移动速度越快(会看到有个线性加速度的效果)。
参数2:b2Vec2结构体,作用力的位置(通常是刚体的质心)。
void b2Body::ApplyTorque(float32 torque) [inline]Apply a torque. This affects the angular velocity without affecting the linear velocity of the center of mass. This wakes up the body.Parameters:torqueabout the z-axis (out of the screen), usually in N-m.
给予刚体一个扭矩,不会改变质心的线性速度(即只会围着质心旋转,也可以理解为改变刚体的角度):
参数1:扭矩,z轴方向。
0 0
- Box2D笔记
- box2d补漏笔记
- box2d 学习笔记
- box2d学习笔记
- Cocos2d 中 Box2D 使用笔记
- Box2D个人学习笔记 - 介绍
- Box2D个人学习笔记 - HelloWorld
- Box2d学习笔记二:第一个box2d程序
- Box2d学习笔记三:box2d中几个重要的类
- Box2D
- Box2D
- box2d
- box2d
- box2d
- box2d
- box2d
- Box2d
- box2d
- Netty框架中使用protocol buffer协议
- 分享8个超棒的基于HTML5和jQuery的开发教程
- 征服 Kestrel<转>
- nginx常见性能参数解析
- 防止二次送信
- Box2D笔记
- 字符串相关操作————2015小米笔试内容
- Log4j解析properties文件中的变量
- java UDP实现局域网广播
- Python的包管理工具pip的安装与使用
- RTSP 协议 认证 (二) --- 未完成
- oracle中使用触发器实现数据同步
- perl 安装DBI,DBD操纵数据库
- iPhone6分辨率与适配