blenderproc.python.modules.object.PhysicsPositioningModule module¶
-
class
blenderproc.python.modules.object.PhysicsPositioningModule.
PhysicsPositioningModule
(config)[source]¶ Bases:
blenderproc.python.modules.main.Module.Module
Performs physics simulation in the scene, assigns new poses for all objects that participated.
It is possible to set object-specific physics attributes via its custom properties: - physics_mass - physics_collision_shape - physics_collision_margin - physics_collision_mesh_source - physics_friction - physics_angular_damping - physics_linear_damping
If an attribute for an object is not set via the custom properties, then the corresponding default value from this module’s configuration is used. See the following table for detailed descriptions about each physics attribute.
Configuration:
Parameter Description Type object_stopped_location_threshold The maximum difference per second and per coordinate in the location vector that is allowed, such that an object is still recognized as ‘stopped moving’. Default: 0.01 float object_stopped_rotation_threshold The maximum difference per second and per coordinate in the rotation Euler vector that is allowed. such that an object is still recognized as ‘stopped moving’. Default: 0.1 float min_simulation_time The minimum number of seconds to simulate. Default: 4.0 float check_object_interval The interval in seconds at which all objects should be checked if they are still moving. If all objects have stopped moving, than the simulation will be stopped. Default: 2.0 float max_simulation_time The maximum number of seconds to simulate. Default: 40.0 int collision_margin The margin around objects where collisions are already recognized. Higher values improve stability, but also make objects hover a bit. This value is used if for an object no custom property physics_collision_margin is set. Default: 0.001. float substeps_per_frame Number of simulation steps taken per frame. Default: 10. int solver_iters Number of constraint solver iterations made per simulation step. Default: 10. int collision_mesh_source Source of the mesh used to create collision shape. This value is used if for an object no custom property physics_collision_mesh_source is set. Default: ‘FINAL’. Available: ‘BASE’, ‘DEFORM’, ‘FINAL’. string collision_shape Collision shape of object in simulation. This value is used if for an object no custom property physics_collision_shape is set. If ‘CONVEX_DECOMPOSITION’ is chosen, the object is automatically decomposed using the V-HACD library. Default: ‘CONVEX_HULL’. Available: ‘BOX’, ‘SPHERE’, ‘CAPSULE’, ‘CYLINDER’, ‘CONE’, ‘CONVEX_HULL’, ‘MESH’, ‘CONVEX_DECOMPOSITION’. string mass_scaling Toggles scaling of mass for objects (1 kg/1m3 of a bounding box). Default: False. bool mass_factor Scaling factor for mass. Defines the linear function mass=bounding_box_volume*mass_factor (defines material density). Default: 1. float friction Resistance of object to movement. This value is used if for an object no custom property physics_friction is set. Default: 0.5. Range: [0, inf] float angular_damping Amount of angular velocity that is lost over time. This value is used if for an object no custom property physics_angular_damping is set. Default: 0.1. Range: [0, 1] float linear_damping Amount of linear velocity that is lost over time. This value is used if for an object no custom property physics_linear_damping is set. Default: 0.04. Range: [0, 1] float convex_decomposition_cache_path If a directory is given, convex decompositions are stored there named after the meshes hash. If the same mesh is decomposed a second time, the result is loaded from the cache and the actual decomposition is skipped. Default: “blenderproc_resources/decomposition_cache” string vhacd_path The directory in which vhacd should be installed or is already installed. Default: “blenderproc_resources/vhacd” string