Box2d学习笔记四:API学习之b2Body

本文是Box2D学习笔记的第四部分,主要聚焦在API的b2Body类上。通过深入探讨b2Body的相关函数,读者将更全面地理解Box2D在物理模拟中的应用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

经过上两次的文章,我们已经对box2d进行物理模拟有了大概的认识,下面我们详细的了解box2d提供的各个类和它们的函数。参照帮助文档:

b2Fixture *  CreateFixture (const b2FixtureDef *def) //创建框架
b2Fixture *  CreateFixture (const b2Shape *shape, float32 density) //以形状和密度为参数创建框架
void  DestroyFixture (b2Fixture *fixture) //摧毁框架
void  SetTransform (const b2Vec2 &position, float32 angle) //设置变换,位置和角度的变换
const b2Transform &  GetTransform () const //得到一个变换
const b2Vec2 &  GetPosition () const //得到刚体的位置
float32  GetAngle () const //得到刚体的角度
const b2Vec2 &  GetWorldCenter () const //得到质心在世界坐标系中的位置
  Get the world position of the center of mass. 
const b2Vec2 &  GetLocalCenter () const //得到质心在本地坐标系中的位置
  Get the local position of the center of mass. 
void  SetLinearVelocity (const b2Vec2 &v) //设置线速度
b2Vec2  GetLinearVelocity () const //得到刚体目前的线速度
void  SetAngularVelocity (float32 omega) //设置角速度
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值