「Dev:Source/Physics/OdeIntegration」の版間の差分
細 (1版 をインポートしました) |
|
(相違点なし)
|
2018年6月29日 (金) 02:45時点における最新版
This page is *severely outdated* | |
ODE was integrated and then removed. Currently, Bullet is being used. If you have questions, email Sergej Reich or ask in #blendercoders at IRC |
目次
Project: integrate ODE library in Blender
UPDATE: this is outdated, check the Rigid Body Physics project.
Online references
- ODE's homepage
- ODE's license: BSD
- user guide
- examples of| ree, academic and commercial projects using ODE
- Chris Hecker's web page about rigid body|dynamics
Introduction
Note: here we reproduce bits of ODE's user guide, denoted like this:
user guide, section 1.0: "The Open Dynamics Engine (ODE) is a free, industrial quality library for simulating articulated rigid body dynamics. For example, it is good for simulating ground vehicles, legged creatures, and moving objects in VR environments. It is fast, flexible and robust, and it has built-in collision detection. ODE is being developed by Russell Smith with help from several contributors."
ODE works with rigid bodies, with the restriction that a body's center of mass and point of reference (position vector) must coincide. A rigid body can have linear (move in straight lines) and angular (spin around an axis through its center of mass) momenta. They can collide with each other and the static environment (other objects in Blender not enabled as "dynamic") but, as the name implies, can't be deformed.
More about rigid bodies in ODE: user guide, section 3.2.
Integration:
- World level: there are global parameters to define for an ODE world: gravity, global ERP and CFM, original or quick step solver, etc.
- Objects level: like with "soft bodies" an object can become dynamic when a user presses an "enable dynamic" button with it selected. This should make the many options available, to set object mass, geometry for collision, rotation mode (finite, infinitesimal), define if it's influenced by gravity, etc.
- Joints: bodies are connected by joints in ODE -- user guide, section 1.1:
"ODE is good for simulating articulated rigid body structures. An articulated structure is created when rigid bodies of various shapes are connected together with joints of various kinds. Examples are ground vehicles (where the wheels are connected to the chassis), legged creatures (where the legs are connected to the body), or stacks of objects."
These are the available joint types: "ball and socket", hinge, hinge2, slider, universal, fixed, contact, angular motor. For descriptions: user guide, section 7.3.
Probably the best alternative to represent joints is to create a new "Joint" object with special representation on screen for each available type.
- Applied forces: between each integration step, we can apply forces to bodies, storing them at their force accumulators. Torques, forces or "impulses" (there's a function to convert them to forces) can also be applied to joints (to the objects they connect).
ODE has two specially important parameters, with global and per object values (user guide, section 3.8):
- ERP: error reduction parameter, a real number in [0, 1] (0 means no reduction, default value is 0.2) to reduce joint errors that can creep in during simulation, for example due to incorrect positioning of joints.
- CFM: constraint force mixing. By default most constraints are "hard", meaning that they can't be violated, but positive values of CFM can be used to define springy or spongy objects (note that the objects themselves don't get deformed, it's only the joint constraint that behaves differently).
not written yet { collision: between rigid bodies and also static objects before each step, see what touches what, contact joints (w/ info about friction, bounciness, softness, etc) group, take step, remove all contact joints from system geoms (10.7: sphere, box, plane, capped cylinder, ray, triangle mesh, composite) spaces (simple, multi-resolution hash table, quadtree) easy to plug different cd library in (SOLID, if needed) enable/disable bodies, spaces }
"Typical simulation code":
From user guide, section 3.10:
- 1-Create a dynamics world.
- 2- Create bodies in the dynamics world.
- 3- Set the state (position etc) of all bodies.
- 4- Create joints in the dynamics world.
- 5- Attach the joints to the bodies.
- 6- Set the parameters of all joints.
- 7- Create a collision world and collision geometry objects, as necessary.
- 8- Create a joint group to hold the contact joints.
- 9- Loop:
- 1. Apply forces to the bodies as necessary.
- 2. Adjust the joint parameters as necessary.
- 3. Call collision detection.
- 4. Create a contact joint for every collision point, and put it in the contact joint group.
- 5. Take a simulation step.
- 6. Remove all joints in the contact joint group.
- 10- Destroy the dynamics and collision worlds."
not written yet { internal details single or double prec common types: dReal (float or double defined on compilation of ODE), dVector3, dVector4, dMatrix3, dMatrix4, dQuaternion. ODE: C++, but with C API. two solvers (5.1): original: a "big matrix" method that can give trouble specially on Windows (need to increase stack space on compile time), uses much more memory, the more accurate quick step: iterative, much faster in large systems, less accurate (but there are hints on how to fight this) has quat helper functions for normal math operations }
Notes
- Integration will require input from Ton and possibly other coders to find what really needs to be created (joint objects, a way to link forces / torques / impulses to objects at each / any frame), changes in Blender's UI, etc.
- Blender could become a great testbed for programmers interested in ODE, if the integration is well done and allows tweaking of most if not all ODE parameters.
- ODE is already used in Blender's Game Engine -- it's already included in Blender's cvs -- but from comments I've read, it still needs to be better integrated there, too.
- It's probably feasible to integrate rigid bodies and Blender's soft bodies (available since 2.37) to get objects that can be governed by ODE but still be deformed. This can be one of the goals for a second step, after ODE is integrated.
-- WillianPadovaniGermano - 12 Jun 2005