Dev:Source/Physics/Rigid Body
This page is *severely outdated* | |
This is meant to be a developer overview of rigid body physics, however it is very outdated. If you have questions, email Sergej Reich or ask in #blendercoders at IRC |
Rigid Body Physics in Blender
New Rigid Body features in Blender 2.43
- Rigid Body Constaint editing is in CVS, ready for 2.43
- done by RCRuiz
- ファイル:Constraint gui.png
- Illusoft will try to get COLLADA 1.4 export/import support for rigid body constraints
- Compound Rigid Bodies
- Children directly connected to Parent can be used as compound object, so they behave properly in collision. No deeper nested children supported yet. Also you need to 'clear parent inverse' (<ALT>P) for this to work.
- ファイル:Rigidbody compound gui.jpg
- Updated to use latest Bullet 2.x version. This adds some improvement, but the migration has a few issues (mostly not hooked up features).
- Baking of rigid body simulation into animation IPO's can be done in two ways
- Through Game Engine menu
- using <LEFT ALT>+<LEFT SHIFT>+<LEFT CTRL> + P-Key.
- Better user interface for Baking, and integration with other simulations (cloth, particle, fluids) planned for next year, after 2.43 release. This includes Bullet C-API
See a preview of Blender 2.43 with demos on this webpage: http://www.continuousphysics.com/Bullet/phpBB2/viewtopic.php?t=752
Blender 2.42 Status
- Basic support for COLLADA 1.4 physics import / export is available in Blender 2.42
- Illusoft is developing the ColladaBlender plugin supporting COLLADA 1.4 Physics
- COLLADA import/export of Collision Detection Shapes: box, sphere, cylinder, cone, convex hull, concave mesh
- COLLADA import/export of Rigid Body information: mass, dynamic/static (non-moving)
- Planned constraints and material (friction/restitution) import/export for Blender 2.43
- Bullet Physics has most features implemented in Blender 2.42 game engine
- Replaced Sumo/SOLID as default physics engine
- Introduction of Bullet Physics in regular modeling planned for in Blender 2.43
Older plans for Rigid Body Physics in Blender (needs updating)
Discussion
We invite you to share your opinions and suggestions for this project:
Introduction
Quick background
Rigid body physics (also referred to as rigid body dynamics or mechanics) deals with the motion of solid bodies subject to external forces (ex: pushes and pulls) caused by gravity, friction and collisions between these bodies. By "solid" it's meant that, as the name indicates, in rigid body dynamics deformations are negleted -- the bodies are idealized as undeformable entities.
Basically we have a system composed of a container "world" populated by objects with physical dimensions. The evolution of this system as time passes is defined by a well known set of rules (in this case equations): Newtonian mechanics.
This simulation can be done by computers, of course. The programs that do so are known as "Physics Engines". Once we have defined the world with its objects and have set all parameters (*), these engines will calculate at each time step the evolution of the system. After that we can update the rigid bodies in our program with their new positions and orientations for the current frame.
(*) global: gravity force; params related to precision, stability and computation speed; etc. and per object: positions, orientations, initial velocities and material properties, etc.
Naturally, there is a lot more to know about rigid body dynamics, for that we indicate the links at the bottom of this page as a good starting point.
In Blender
This idealized system can mimic well a lot of what happens in our macroscopic world and that is what it's useful for in many applications, today's games and animation software included.
In Blender we can use rigid bodies functionality to animate the dynamics of objects moving, rotating and colliding with each other. This is much easier, faster, more realistic and funner than trying to recreate it manually, of course. Even for simple cases, not to mention scenes where we can have hundreds or thousands of objects falling and colliding against each other and static obstacles.
Right now rigid body dynamics is already available in the Game Engine (the results can be "baked" to be used in animations). This project aims to bring the functionality to the animation system itself. With this it will be much easier to create and control rigid bodies, without having to bake the animation (so saving up space).
Project Goals
- Integrate rigid body dynamics in Blender's animation system.
- Discuss and plan the integration of the various physics systems in Blender (soft bodies, fluids, particles, rigid bodies, cloth).
Plan
Rigid Body Dynamics
- Basic integration
- Researching and discussion to decide specific implementation issues:
- where to put rigid body data;
- where to calculate a new simulation step for each frame in relation to the evaluation of already existing functionality (Blender constraints, Ipos, etc.);
- GUI.
- Define an abstract layer (C API) to hook Blender and an external physics engine.
- Implement access to an specific engine: the Bullet Continuous Collision Detection and Physics Library:
- rigid body dynamics
- constraints (joints)
- Support COLLADA 1.4 physics import / export.
- Implement Blender Ipo's <-> rigid bodies connection to allow for the mixing of baked animation and dynamics. From here on interesting possibilities are opened for new features in Blender using the coded structure.
- Add support for other engine(s) if desired or needed, using the implemented abstract API.
- Researching and discussion to decide specific implementation issues:
- Why Bullet
All in all, lib A vs. lib B is not a real issue in this case, since the plan is to implement an abstract C API layer between Blender and the physics engine. With this, ODE, and other solutions (maybe something like PhysX ?) can be added later. That said, having ODE implemented in Blender has been in the plans for a long time, already, even before we knew about Bullet.
In favor of ODE: it's basically the standard open source physics engine, well known and with features still not present in Bullet (motors, joint limits) and many users. Its development seems to have suffered since the last official release, around the middle of 2004, but a group of developers is working to bring a new release with bug-fixes, new features and updated documentation.
In favor of Bullet: Bullet has better convex collision detection, better contact management (persistent contacts with warm starting), swept collision tests, and all collision shape interactions are implemented (ODE doesn't have all combinations between convex, box and cylinder implemented). Erwin Coumans, Bullet's author, is also an active Blender developer. He recently integrated and now maintains and improves Bullet support in Blender's game engine. To promote his library, he has direct interest in its implementation in Blender's animation system and has offered to work on this. He will start by providing a C wrapper for Bullet and the abstraction layer to hook it to Blender. About his involvement in this field: Erwin is the original author of Blender's game engine and after that worked for Havok and now Sony, participating in the ellaboration of the COLLADA physics API specs. He is also committed to continue improving and expanding Bullet, naturally.
- Future discussions
Once we have rigid bodies implemented in Blender we can analyse the whole situation and discuss with the authors / maintainers of the other tools and interested developers and users.
- Collision detection
An interesting possibility is to promote Bullet's collision detection library for general use within Blender. For that Erwin might provide a C API to access this library, like he'll provide for dynamics in the first part of this project.
Resources
Those interested in the current state of Bullet in Blender's game engine are invited to download Blender 2.42 and a package with demo .blend files:
- Blender 2.42 Download
http://download.blender.org/release/Blender2.42/
- Bullet physics demos for the Blender 2.42
Older Projects
This project should encapsulate/replace previous projects:
- ODE integration (old) -- Willian - 12 Jun 2005
- BlendODE -- RCRuiz - 20 Feb 2006
For more information
- Rigid bodies
- Rigid body dynamics
- Chris Hecker's famous web page about rigid body dynamics
- Physics Simulation Forum