Dev:Source/GameEngine/2.49/BulletSoftBody

提供: wiki
移動先: 案内検索

Bullet Soft Bodies in the Blender Game Engine

Overview

From Blender 2.48 onwards, the game engine features Bullet soft body simulation. Here is some information about features and how to use them.

Soft Body Features

  • Flat cloth or volumetric soft bodies
  • Control over mass, friction, stiffness, shape matching and collision detection settings
  • Collision detection beween soft bodies as well as rigid bodies and static collision bounds of all types.
  • Attaching soft bodies against rigid bodies or using fixed pinning
  • Physics Debug Visualization of the dynamic soft body structures
  • Dynamically create new soft bodies using the Add Object Actuator

Sample files and feedback

Creating a Bullet soft body

  • Game Buttons: choose between static, dynamic, rigid body or soft body
Softbody select new small.jpg
  • Choosing collision shape bounds for soft bodies
  • The bounds type for soft bodies are automatically restricted to convex hull or triangle mesh bounds.

Basic Soft Body Setting

  • Linear Stiffness: lower values create very flexible soft bodies, and larger value (1) more stiff. Note that the shape matching feature and bending constraints will still keep extreme flexible bodies in shape.
  • Shape matching: If this option is enabled, Bullet will remember the original shape of each soft body, and tries to match the shape of a soft body, no matter how large the deformation has been.
  • kMT Shape mathing coefficient: how strong the soft body will return to its original shape. This only appear when the Shape Matching option is enabled.
  • Friction allows to control the dynamic friction for soft bodies, in the range [0..1]. 0 means no friction, soft bodies will slide.

Softbody new buttons.jpg

Advanced Settings

  • Use Clusters: collision clusters can improve the collision detection, and it can avoid soft bodies passing through triangle meshes. Instead of colliding between individual vertices/nodes and faces, deformable convex clusters can be used. You can choose to use clusters between soft bodies, or between soft body and rigid body.
  • Cluster Iterations: Higher values will create more detailed collision clusters. If you choose 1 it will use a single cluster using all vertices. This setting is only used if Clusters RB / SS is enabled.
  • Position Iter: position solver iterations. Use a higher value to improve the quality of position correction for soft bodies.

Softbody advanced new.jpg

Pinning or attaching soft bodies

  • You can use the Rigid Body Joint to attach a rigid body against a soft body. Similar to rigid body constraints, you can also pin/fix a soft body to make a vertex non-movable: just don't provide a second attachment object, or attach to a static object.
  • Right now, vertex groups are not supported, so you have to use Rigid Body Joint constraints.
  • Select a single soft body, or both a soft body and rigid body, using the Rigid Body Joint button:
Softbody constraint selection smaller.jpg
  • Enable the Show Pivot to see where the soft body will be pinned (px/py/pz frame). Bullet will automatically take the closest vertex/node to this pivot point.
  • You can use multiple constraints to pin/attach multiple parts of the soft body.
  • Use No Col button to disable collision detection between bodies connected by constraints. This might avoid instability and jitter between connected bodies.

Disable collision connected.jpg

  • Python constraints can be used to create soft body constraints while the game is running. However, currently you cannot remove those constraints on-the-fly.

General soft body tips and some known issues

  • Add Object Actuator can be used to dynamically add new soft bodies.
Add object actuator.jpg
  • Only the applyForce in the motion actuator is enabled. setPosition, constraint actuator and other logic doesn't work with soft bodies.
  • Soft body option will draw objects as 'smooth', because it always updates both vertices and vertex normals.
  • Subdivide the soft body triangle mesh to allow some deformation: go into edit more, select all vertices (A) and hit subdivide.

Subdivide mesh small.jpg

  • UV Sphere meshes are not compatible with soft bodies, so use a Ico sphere instead.
  • If the mesh is too detailed, simplify the mesh using mesh decimation:

Mesh decimation small.jpg

  • Blender 2.48 performs no collisions between soft bodies that have Clusters enabled, and soft bodies that have Clusters disabled. This will be fixed in future versions.
  • Use Show Physics Visualization to debug issues with soft bodies, collision shapes etc. Enable the setting in the game menu:
  • When running the game with Show Physics Visualization enabled, you will notice the complex dynamic structures for soft bodies.
  • Self-collision is not currently supported.
  • There are no python bindings to control soft bodies, and no logic brick support, except for apply force and add object actuator.
  • Soft body / cloth objects don't support the collision/near/radar sensor.
  • There is currently a large gap/margin between cloth and collision objects. There is no control over this gap right now, it might improve in later/future Blender versions.
  • Don't use scaled meshes. Instead, use the Apply Scaling feature, or Apply Scale and Rotation by selecting the soft body object and pressing <CTRL> A:

Apply scaling.jpg