Bullet Physics Features in Blender

From Physics Simulation Wiki

Jump to: navigation, search

Contents

Bullet Game Engine Features

Collision Shapes

  • Box, Sphere, Convex Hull, Cylinder, Cone and static Triangle Mesh

Game Logic

  • Ray Sensor
  • Near Sensor
  • Collision Sensor

Python Bullet Physics Extensions

See below for Constraints and Vehicle setup through Python.

A new python module, PhysicsConstraints, gives access to internal physics settings.

settings that influence quality of the rigidbody dynamics

  • PhysicsConstraints.setGravity
changes gravity
  • PhysicsConstraints.setNumIterations
Increasing the number of iterations improves the constraint solver. It will descrease performance.
  • PhysicsConstraints.setNumTimeSubSteps
Increasing the number of time substeps improves the quality of the entire physics simulation, including collision detection and constraint solver. It will descrease performance.
Set the number of timesubsteps to 0 to suspend simulation
  • PhysicsConstraints.setDeactivationTime(float time)
Time (in seconds) after objects with velocity less then tresholds (see below) are deactivated
  • PhysicsConstraints.setDeactivationLinearTreshold
Deactivation treshold for linear movement
  • PhysicsConstraints.setDeactivationAngularTreshold
Deactivation treshold for angular/rotation movement
  • PhysicsConstraints.setLinearAirDamping
  • PhysicsConstraints.createConstraint
See constraint demos, p2p2 and hinge
  • PhysicsConstraints.getVehicleConstraint
See vehicle demo
  • PhysicsConstraints.removeConstraint(int constraintId)

methods for internal testing, please ignore for now

  • PhysicsConstraints.setDebugMode, setContactBreakingTreshold, setCcdMode, setSorConstant, setSolverTau, setSolverDamping, setSolverType

Constraints

  • Point to point (ball socket/spherical joint)
  • Hinge (revolute joint)

Vehicle

Using Python script, a vehicle can be setup. See the demos for usage.

Bullet for Physics based Animation

Game Menu has an option:

  • Record to IPO keyframes
During game play ('p') every frame an IPO keyframe is inserted for position and orientation, for dynamic objects.

More Rigid Body dynamics features are planned here: RigidBodyPhysics in the Blender Wiki

Bullet Python Exporting Features

Blender module in the Python API has Rigid Body information, used by the COLLADA exporter/importer.

import Blender
scene = Blender.Scene.getCurrent()
blenderobject = scene.getActiveObject()
  • blenderobject.rbMass
  • blenderobject.rbFlags
RB Flags bits: 0 = OB_DYNAMIC, 1 = OB_CHILD, 2 = OB_ACTOR, 3/4/5 = OB_INERTIA_LOCK_X/Y/Z, 6 = OB_DO_FH, 7 = OB_ROT_FH, 8 = OB_ANISOTROPIC_FRICTION, 9 = OB_GHOST, 10 = OB_RIGID_BODY, 11 = OB_BOUNDS, 12 = OB_COLLISION_RESPONSE
Some deprecated flags: 13 = OB_SECTOR, 14 = OB_PROP, 15 = OB_MAINACTOR
  • blenderobject.rbShapeBoundType
0 = BOX, 1 = SPHERE, 2 = CYLINDER, 3 = CONE, 5 = CONVEX HULL, 4 = TRIMESH
Use in combination with RB Flags bit 11 OB_BOUNDS
Personal tools