Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Bullet3D
Physics Engine rigid body soft body
Created by Erwin Coumans (previously of Sony) Professional-grade library Open Source Free for commercial use
Physics Features
Continuous & Discrete Collision Ray & Convex Sweep Test Flexible Algorithm Selection System. Ex: Broad Phase: Sweep & Prune Narrow Phase: GJK
Collision Shapes
Concave & Convex Meshes All basic Primitives
Advanced Features
Rigid body dynamics constraint solver Vehicle dynamics Character controller & solver Ragdoll physics Soft body dynamics cloth rope deformable volumes
Bullet3D Components
Resolve collisions & other constraints Provide objects' updated world transform
Bullet Setup
#include btBulletDynamicsCommon.h
include Bullet/src path (VS) build using these libs: BulletDynamics BulletCollision LinearMath
Learn to create:
btDiscreteDynamicsWorld btcollisionShape
btMotionState
btRigidBody
Each frame: call stepSimulation on dynamic world use world transform to render your object
Provide:
mass (0 if static) collision shape material properties
frictional coefficient coefficient of restitution
Sphere Cone
Convex Hull Triangle Mesh
btVector3
x,y,z,w for 3D positions and vectors
btClock
measures time to microsecond accuracy 1/1,000,000 sec
btAlignedFree
free allocated memory
a collision shape
btCollisionShape
box, sphere, convex hull, triangle mesh\
a single collision shape can be shared among multiple collision objects
btCollisionWorld
stores all collision objects
Collision Margin
Minimum Separation
creates small gap Bullet3D uses 0.04 4 cm can be changed, but don't set to 0
Bullet Tips
Avoid very large and very small collision shapes
minimum: 20 cm max: 5 m