经过上两次的文章,我们已经对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) //设置角速度 |