您的位置:首页 > 其它

/LGC物理引擎/Box2D:一个 2D rigid body 物理引擎

2010-12-29 09:13 633 查看
Box2D:一个 2D rigid body 物理引擎

作者:
刘鹏

日期:

2009-03-09

Box2D 是一个2D rigid body 物理引擎,本文介绍了它的基本情况、主要特色以及使用 Box2D 开发程序的基本思路。

Overview

Box2D 是一个功能丰富的 2D rigid body 物理引擎,基于 C++ 开发,作者是 Erin Catto。使用 Box2D,开发人员可以使对象运动时具有物理效果,如惯性、自由落体、碰撞等等。
2D rigid body 是一个不会变形的物体,它具有质量和惯性。它的状态由重心和旋转角度决定。它的动态移动由线速度和角速度控制。3

Box2D 已在多个游戏中使用,包括 Crayon Physics Deluxe
,该游戏赢得了 2008 Independent Game Festival Grand Prize。

Box2D 已经移植到 Flash、Java、C#、Python、JavaScript、D 和具有定点数运算能力的嵌入式设备上。

Features1

Collision

Continuous collision detection.

Contact callbacks: add, persist, remove.

Convex polyons and circles.

Multiple shapes per body

One-shot contact manifolds

Incremental sweep-and-prune broadphase

Efficient pair management

Fast broadphase AABB queries

Collision groups and categories

Physics

Continuous physics with time of impact island solver.

Persistent body-joint-contact graph

Island solution and sleep management

Contact, friction, and restitution

Stable stacking with a linear-time solver

Revolute, prismatic, distance, pulley, gear, and mouse joints

Joint limits, motors, and friction

Momentum decoupled position correction

Fairly accurate reaction forces/impulses

System

Small block and stack allocators

Centralized tuning parameters

Highly portable C++ with no use of STL containers

Box2D 开发基本思路

create a world

create a Ground Box

Create a Dynamic Body

Simulating the World

time step is 60Hz 或者 1/60 秒

integrator,在离散时间点模拟物理方程

simulation loop : call b2World::Step.

细节内容可以参考 box2d manual 中的 helloworld 例子,http://www.box2d.org/manual.html#d0e110


Reference

1. Box2D Features

2. box2d wiki

3. Rigid Body

4. box2d manual
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: