30 "Object is directly controlled by simulation results"},
35 "Object is directly controlled by animation system"},
36 {0,
nullptr, 0,
nullptr,
nullptr},
45 "Box-like shapes (i.e. cubes), including planes (i.e. ground planes)"},
54 "A mesh-like surface encompassing (i.e. shrinkwrap over) all vertices (best results with "
60 "Mesh consisting of triangles only, allowing for more detailed interactions than convex "
66 "Combines all of its direct rigid body children into one rigid object"},
67 {0,
nullptr, 0,
nullptr,
nullptr},
72 {
RBC_TYPE_FIXED,
"FIXED", ICON_NONE,
"Fixed",
"Glue rigid bodies together"},
77 "Constrain rigid bodies to move around common pivot point"},
78 {
RBC_TYPE_HINGE,
"HINGE", ICON_NONE,
"Hinge",
"Restrict rigid body rotation to one axis"},
83 "Restrict rigid body translation to one axis"},
88 "Restrict rigid body translation and rotation to one axis"},
93 "Restrict translation and rotation to specified axes"},
98 "Restrict translation and rotation to specified axes with springs"},
99 {
RBC_TYPE_MOTOR,
"MOTOR", ICON_NONE,
"Motor",
"Drive rigid body around or along an axis"},
100 {0,
nullptr, 0,
nullptr,
nullptr},
109 "Spring implementation used in Blender 2.7. Damping is capped at 1.0"},
114 "New implementation available since 2.8"},
115 {0,
nullptr, 0,
nullptr,
nullptr},
122 {
RBO_MESH_DEFORM,
"DEFORM", 0,
"Deform",
"Deformations (shape keys, deform modifiers)"},
124 {0,
nullptr, 0,
nullptr,
nullptr},
150static std::optional<std::string> rna_RigidBodyWorld_path(
const PointerRNA * )
152 return "rigidbody_world";
159 rbw->num_solver_iterations =
value;
183static void rna_RigidBodyWorld_objects_collection_update(
Main *bmain,
189 rna_RigidBodyWorld_reset(bmain,
scene,
ptr);
192static void rna_RigidBodyWorld_constraints_collection_update(
Main *bmain,
198 rna_RigidBodyWorld_reset(bmain,
scene,
ptr);
205 if (
scene !=
nullptr) {
215 rna_RigidBodyOb_reset(bmain,
scene,
ptr);
223 if (
scene !=
nullptr) {
229 if (rbo->shared->physics_shape) {
238 rna_RigidBodyOb_reset(bmain,
scene,
ptr);
244static std::optional<std::string> rna_RigidBodyOb_path(
const PointerRNA * )
300 rbo->friction =
value;
303 if (rbo->shared->physics_object) {
313 rbo->restitution =
value;
315 if (rbo->shared->physics_object) {
328 if (rbo->shared->physics_shape) {
335static void rna_RigidBodyOb_collision_collections_set(
PointerRNA *
ptr,
const bool *values)
340 for (i = 0; i < 20; i++) {
342 rbo->col_groups |= (1 << i);
345 rbo->col_groups &= ~(1 << i);
359 if (rbo->shared->physics_object) {
385 rbo->lin_sleep_thresh =
value;
400 rbo->ang_sleep_thresh =
value;
415 rbo->lin_damping =
value;
429 rbo->ang_damping =
value;
439static std::optional<std::string> rna_RigidBodyCon_path(
const PointerRNA * )
442 return "rigid_body_constraint";
457 rbc->spring_type =
value;
468 if (rbc->physics_constraint) {
490 if (rbc->physics_constraint) {
492 rbc->breaking_threshold);
497 rbc->flag &= ~RBC_FLAG_USE_BREAKING;
499 if (rbc->physics_constraint) {
511 rbc->breaking_threshold =
value;
521static void rna_RigidBodyCon_override_solver_iterations_set(
PointerRNA *
ptr,
bool value)
528 if (rbc->physics_constraint) {
530 rbc->num_solver_iterations);
535 rbc->flag &= ~RBC_FLAG_OVERRIDE_SOLVER_ITERATIONS;
537 if (rbc->physics_constraint) {
549 rbc->num_solver_iterations =
value;
560static void rna_RigidBodyCon_do_set_spring_stiffness(
RigidBodyCon *rbc,
628 rbc->spring_stiffness_ang_y =
value;
639 rbc->spring_stiffness_ang_z =
value;
647static void rna_RigidBodyCon_do_set_spring_damping(
RigidBodyCon *rbc,
713 rbc->spring_damping_ang_y =
value;
723 rbc->spring_damping_ang_z =
value;
733 rbc->motor_lin_max_impulse =
value;
738 static_cast<rbConstraint *
>(rbc->physics_constraint),
value, rbc->motor_ang_max_impulse);
750 if (rbc->physics_constraint) {
765 if (rbc->physics_constraint) {
773static void rna_RigidBodyCon_motor_lin_target_velocity_set(
PointerRNA *
ptr,
float value)
777 rbc->motor_lin_target_velocity =
value;
783 rbc->motor_ang_target_velocity);
792 rbc->motor_ang_max_impulse =
value;
797 static_cast<rbConstraint *
>(rbc->physics_constraint), rbc->motor_lin_max_impulse,
value);
802static void rna_RigidBodyCon_motor_ang_target_velocity_set(
PointerRNA *
ptr,
float value)
806 rbc->motor_ang_target_velocity =
value;
811 rbc->motor_lin_target_velocity,
818static void rna_RigidBodyWorld_convex_sweep_test(
RigidBodyWorld *rbw,
821 const float ray_start[3],
822 const float ray_end[3],
844 "A non convex collision shape was passed to the function, use only convex "
852 "Rigidbody world was not properly initialized, need to step the simulation first");
855 UNUSED_VARS(rbw, reports,
object, ray_start, ray_end, r_location, r_hitpoint, r_normal, r_hit);
878 srna,
"Rigid Body World",
"Self-contained rigid body simulation environment and settings");
888 prop,
"Collection",
"Collection containing objects participating in this simulation");
896 prop,
"Constraints",
"Collection containing rigid body constraint objects");
922 "Substeps Per Frame",
923 "Number of simulation steps taken per frame (higher values are more accurate "
934 prop,
nullptr,
"rna_RigidBodyWorld_num_solver_iterations_set",
nullptr);
938 "Number of constraint solver iterations made per simulation step (higher values are more "
939 "accurate but slower)");
949 "Reduce extra velocity that can build up when objects collide (lowers simulation "
950 "stability a little so use only when necessary)");
957 prop,
"rna_RigidBodyWorld_PointCache_get",
nullptr,
nullptr,
nullptr);
969 func =
RNA_def_function(srna,
"convex_sweep_test",
"rna_RigidBodyWorld_convex_sweep_test");
971 func,
"Sweep test convex rigidbody against the current rigidbody world");
974 func,
"object",
"Object",
"",
"Rigidbody object with a convex collision shape");
989 "The hit location of this sweep test",
1001 "The hit location of this sweep test",
1013 "The face normal at the sweep test hit location",
1024 "If the function has found collision point, value is 1, otherwise 0",
1038 srna,
"Rigid Body Object",
"Settings for object participating in Rigid Body Simulation");
1054 prop,
"Mesh Source",
"Source of the mesh used to create collision shape");
1070 prop,
"Collision Shape",
"Collision Shape of object in Rigid Body Simulations");
1078 prop,
"Kinematic",
"Allow rigid body to be controlled by the animation system");
1105 "Enable Deactivation",
1106 "Enable deactivation of resting rigid bodies (increases performance and stability "
1107 "but can cause glitches)");
1113 prop,
"Start Deactivated",
"Deactivate rigid body at the start of the simulation");
1124 "Linear Velocity Deactivation Threshold",
1125 "Linear Velocity below which simulation stops simulating object");
1135 "Angular Velocity Deactivation Threshold",
1136 "Angular Velocity below which simulation stops simulating object");
1146 prop,
"Linear Damping",
"Amount of linear velocity that is lost over time");
1155 prop,
"Angular Damping",
"Amount of angular velocity that is lost over time");
1176 "Tendency of object to bounce after colliding with another "
1177 "(0 = stays still, 1 = perfectly elastic)");
1187 "Use custom collision margin (some shapes will have a visible gap around them)");
1199 "Threshold of distance near surface where collisions are still considered "
1200 "(best results when non-zero)");
1207 prop,
"Collision Collections",
"Collision collections rigid body belongs to");
1220 "Rigid Body Constraint",
1221 "Constraint influencing Objects inside Rigid Body Simulation");
1251 prop,
"Disable Collisions",
"Disable collisions between constrained rigid bodies");
1273 prop,
"Breakable",
"Constraint can be broken if it receives an impulse above the threshold");
1283 "Breaking Threshold",
1284 "Impulse threshold that must be reached for the constraint to break");
1292 "Override Solver Iterations",
1293 "Override the number of solver iterations for this constraint");
1304 "Solver Iterations",
1305 "Number of constraint solver iterations made per simulation step (higher values are more "
1306 "accurate but slower)");
1493 prop,
nullptr,
"rna_RigidBodyCon_spring_stiffness_ang_x_set",
nullptr);
1503 prop,
nullptr,
"rna_RigidBodyCon_spring_stiffness_ang_y_set",
nullptr);
1513 prop,
nullptr,
"rna_RigidBodyCon_spring_stiffness_ang_z_set",
nullptr);
1546 prop,
nullptr,
"rna_RigidBodyCon_spring_damping_ang_x_set",
nullptr);
1555 prop,
nullptr,
"rna_RigidBodyCon_spring_damping_ang_y_set",
nullptr);
1564 prop,
nullptr,
"rna_RigidBodyCon_spring_damping_ang_z_set",
nullptr);
1574 prop,
nullptr,
"rna_RigidBodyCon_motor_lin_target_velocity_set",
nullptr);
1584 prop,
nullptr,
"rna_RigidBodyCon_motor_lin_max_impulse_set",
nullptr);
1594 prop,
nullptr,
"rna_RigidBodyCon_motor_ang_target_velocity_set",
nullptr);
1604 prop,
nullptr,
"rna_RigidBodyCon_motor_ang_max_impulse_set",
nullptr);
void BKE_report(ReportList *reports, eReportType type, const char *message)
API for Blender-side Rigid Body stuff.
#define RBO_GET_MASS(rbo)
#define RBO_GET_MARGIN(rbo)
void BKE_rigidbody_cache_reset(struct RigidBodyWorld *rbw)
struct rbDynamicsWorld * BKE_rigidbody_world_physics(struct RigidBodyWorld *rbw)
void BKE_rigidbody_constraints_collection_validate(struct Scene *scene, struct RigidBodyWorld *rbw)
void BKE_rigidbody_objects_collection_validate(struct Main *bmain, struct Scene *scene, struct RigidBodyWorld *rbw)
#define SET_FLAG_FROM_TEST(value, test, flag)
void DEG_relations_tag_update(Main *bmain)
Types and defines for representing Rigid Body entities.
@ RBW_FLAG_USE_SPLIT_IMPULSE
@ RBO_FLAG_START_DEACTIVATED
@ RBO_FLAG_NEEDS_VALIDATE
@ RBO_FLAG_USE_DEACTIVATION
@ RBC_FLAG_NEEDS_VALIDATE
@ RBC_FLAG_USE_SPRING_ANG_Y
@ RBC_FLAG_USE_SPRING_ANG_X
@ RBC_FLAG_USE_LIMIT_ANG_X
@ RBC_FLAG_USE_LIMIT_LIN_Y
@ RBC_FLAG_USE_LIMIT_ANG_Y
@ RBC_FLAG_DISABLE_COLLISIONS
@ RBC_FLAG_OVERRIDE_SOLVER_ITERATIONS
@ RBC_FLAG_USE_LIMIT_LIN_X
@ RBC_FLAG_USE_SPRING_ANG_Z
@ RBC_FLAG_USE_LIMIT_LIN_Z
@ RBC_FLAG_USE_LIMIT_ANG_Z
Rigid Body API for interfacing with external Physics Engines.
struct rbConstraint rbConstraint
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
void RB_constraint_set_max_impulse_motor(rbConstraint *con, float max_impulse_lin, float max_impulse_ang)
void RB_dworld_set_solver_iterations(rbDynamicsWorld *world, int num_solver_iterations)
void RB_dworld_set_split_impulse(rbDynamicsWorld *world, int split_impulse)
void RB_constraint_set_stiffness_6dof_spring(rbConstraint *con, int axis, float stiffness)
void RB_body_set_restitution(rbRigidBody *object, float value)
void RB_body_set_friction(rbRigidBody *object, float value)
void RB_body_set_mass(rbRigidBody *object, float value)
void RB_body_set_activation_state(rbRigidBody *object, int use_deactivation)
void RB_constraint_set_damping_6dof_spring(rbConstraint *con, int axis, float damping)
void RB_constraint_set_enabled(rbConstraint *con, int enabled)
void RB_body_set_angular_sleep_thresh(rbRigidBody *object, float value)
void RB_constraint_set_stiffness_6dof_spring2(rbConstraint *con, int axis, float stiffness)
void RB_body_set_angular_damping(rbRigidBody *object, float value)
void RB_constraint_set_breaking_threshold(rbConstraint *con, float threshold)
void RB_world_convex_sweep_test(rbDynamicsWorld *world, rbRigidBody *object, const float loc_start[3], const float loc_end[3], float v_location[3], float v_hitpoint[3], float v_normal[3], int *r_hit)
void RB_constraint_set_enable_motor(rbConstraint *con, int enable_lin, int enable_ang)
void RB_body_set_linear_damping(rbRigidBody *object, float value)
void RB_constraint_set_solver_iterations(rbConstraint *con, int num_solver_iterations)
void RB_constraint_set_damping_6dof_spring2(rbConstraint *con, int axis, float damping)
void RB_shape_set_margin(rbCollisionShape *shape, float value)
void RB_body_set_linear_sleep_thresh(rbRigidBody *object, float value)
void RB_body_set_kinematic_state(rbRigidBody *object, int kinematic)
void RB_constraint_set_target_velocity_motor(rbConstraint *con, float velocity_lin, float velocity_ang)
PointerRNA RNA_pointer_create_with_parent(const PointerRNA &parent, StructRNA *type, void *data)
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_struct_path_func(StructRNA *srna, const char *path)
void RNA_def_parameter_clear_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
void RNA_def_property_float_default(PropertyRNA *prop, float value)
void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
void RNA_def_property_boolean_bitset_array_sdna(PropertyRNA *prop, const char *structname, const char *propname, const int64_t booleanbit, const int length)
PropertyRNA * RNA_def_float_vector(StructOrFunctionRNA *cont_, const char *identifier, const int len, const float *default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
void RNA_def_property_boolean_default(PropertyRNA *prop, bool value)
void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const char *set)
void RNA_def_property_int_default(PropertyRNA *prop, int value)
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier, const char *call)
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char *set, const char *item)
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
void RNA_def_function_flag(FunctionRNA *func, int flag)
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set, const char *type_fn, const char *poll)
void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void RNA_def_function_output(FunctionRNA *, PropertyRNA *ret)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision)
void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, const int default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
void RNA_def_property_boolean_negative_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
void RNA_def_rigidbody(BlenderRNA *brna)
const EnumPropertyItem rna_enum_rigidbody_object_type_items[]
const EnumPropertyItem rna_enum_rigidbody_object_shape_items[]
static void rna_def_rigidbody_object(BlenderRNA *brna)
const EnumPropertyItem rna_enum_rigidbody_constraint_type_items[]
static void rna_def_rigidbody_world(BlenderRNA *brna)
static void rna_def_rigidbody_constraint(BlenderRNA *brna)
static const EnumPropertyItem rigidbody_mesh_source_items[]
static const EnumPropertyItem rna_enum_rigidbody_constraint_spring_type_items[]
float spring_damping_ang_x
void * physics_constraint
float spring_stiffness_ang_x
struct RigidBodyOb_Shared * shared
struct PointCache * pointcache
struct RigidBodyWorld_Shared * shared
struct RigidBodyWorld * rigidbody_world
void WM_main_add_notifier(uint type, void *reference)