36 "Object is directly controlled by simulation results"},
41 "Object is directly controlled by animation system"},
42 {0,
nullptr, 0,
nullptr,
nullptr},
51 "Box-like shapes (i.e. cubes), including planes (i.e. ground planes)"},
60 "A mesh-like surface encompassing (i.e. shrinkwrap over) all vertices (best results with "
66 "Mesh consisting of triangles only, allowing for more detailed interactions than convex "
72 "Combines all of its direct rigid body children into one rigid object"},
73 {0,
nullptr, 0,
nullptr,
nullptr},
78 {
RBC_TYPE_FIXED,
"FIXED", ICON_NONE,
"Fixed",
"Glue rigid bodies together"},
83 "Constrain rigid bodies to move around common pivot point"},
84 {
RBC_TYPE_HINGE,
"HINGE", ICON_NONE,
"Hinge",
"Restrict rigid body rotation to one axis"},
89 "Restrict rigid body translation to one axis"},
94 "Restrict rigid body translation and rotation to one axis"},
99 "Restrict translation and rotation to specified axes"},
104 "Restrict translation and rotation to specified axes with springs"},
105 {
RBC_TYPE_MOTOR,
"MOTOR", ICON_NONE,
"Motor",
"Drive rigid body around or along an axis"},
106 {0,
nullptr, 0,
nullptr,
nullptr},
115 "Spring implementation used in Blender 2.7. Damping is capped at 1.0"},
120 "New implementation available since 2.8"},
121 {0,
nullptr, 0,
nullptr,
nullptr},
128 {
RBO_MESH_DEFORM,
"DEFORM", 0,
"Deform",
"Deformations (shape keys, deform modifiers)"},
130 {0,
nullptr, 0,
nullptr,
nullptr},
153static std::optional<std::string> rna_RigidBodyWorld_path(
const PointerRNA * )
155 return "rigidbody_world";
158static void rna_RigidBodyWorld_num_solver_iterations_set(
PointerRNA *
ptr,
int value)
162 rbw->num_solver_iterations = value;
165 if (rbw->shared->physics_world) {
172static void rna_RigidBodyWorld_split_impulse_set(
PointerRNA *
ptr,
bool value)
179 if (rbw->shared->physics_world) {
185static void rna_RigidBodyWorld_objects_collection_update(
Main *bmain,
191 rna_RigidBodyWorld_reset(bmain, scene,
ptr);
194static void rna_RigidBodyWorld_constraints_collection_update(
Main *bmain,
200 rna_RigidBodyWorld_reset(bmain, scene,
ptr);
207 if (scene !=
nullptr) {
217 rna_RigidBodyOb_reset(bmain, scene,
ptr);
225 if (scene !=
nullptr) {
231 if (rbo->shared->physics_shape) {
240 rna_RigidBodyOb_reset(bmain, scene,
ptr);
246static std::optional<std::string> rna_RigidBodyOb_path(
const PointerRNA * )
252static void rna_RigidBodyOb_type_set(
PointerRNA *
ptr,
int value)
260static void rna_RigidBodyOb_shape_set(
PointerRNA *
ptr,
int value)
268static void rna_RigidBodyOb_disabled_set(
PointerRNA *
ptr,
bool value)
284static void rna_RigidBodyOb_mass_set(
PointerRNA *
ptr,
float value)
298static void rna_RigidBodyOb_friction_set(
PointerRNA *
ptr,
float value)
302 rbo->friction = value;
305 if (rbo->shared->physics_object) {
311static void rna_RigidBodyOb_restitution_set(
PointerRNA *
ptr,
float value)
315 rbo->restitution = value;
317 if (rbo->shared->physics_object) {
323static void rna_RigidBodyOb_collision_margin_set(
PointerRNA *
ptr,
float value)
330 if (rbo->shared->physics_shape) {
337static void rna_RigidBodyOb_collision_collections_set(
PointerRNA *
ptr,
const bool *values)
342 for (i = 0; i < 20; i++) {
344 rbo->col_groups |= (1 << i);
347 rbo->col_groups &= ~(1 << i);
353static void rna_RigidBodyOb_kinematic_state_set(
PointerRNA *
ptr,
bool value)
361 if (rbo->shared->physics_object) {
369static void rna_RigidBodyOb_activation_state_set(
PointerRNA *
ptr,
bool value)
383static void rna_RigidBodyOb_linear_sleepThresh_set(
PointerRNA *
ptr,
float value)
387 rbo->lin_sleep_thresh = value;
398static void rna_RigidBodyOb_angular_sleepThresh_set(
PointerRNA *
ptr,
float value)
402 rbo->ang_sleep_thresh = value;
413static void rna_RigidBodyOb_linear_damping_set(
PointerRNA *
ptr,
float value)
417 rbo->lin_damping = value;
427static void rna_RigidBodyOb_angular_damping_set(
PointerRNA *
ptr,
float value)
431 rbo->ang_damping = value;
441static std::optional<std::string> rna_RigidBodyCon_path(
const PointerRNA * )
444 return "rigid_body_constraint";
447static void rna_RigidBodyCon_type_set(
PointerRNA *
ptr,
int value)
455static void rna_RigidBodyCon_spring_type_set(
PointerRNA *
ptr,
int value)
459 rbc->spring_type = value;
463static void rna_RigidBodyCon_enabled_set(
PointerRNA *
ptr,
bool value)
470 if (rbc->physics_constraint) {
476static void rna_RigidBodyCon_disable_collisions_set(
PointerRNA *
ptr,
bool value)
485static void rna_RigidBodyCon_use_breaking_set(
PointerRNA *
ptr,
bool value)
492 if (rbc->physics_constraint) {
494 rbc->breaking_threshold);
499 rbc->flag &= ~RBC_FLAG_USE_BREAKING;
501 if (rbc->physics_constraint) {
509static void rna_RigidBodyCon_breaking_threshold_set(
PointerRNA *
ptr,
float value)
513 rbc->breaking_threshold = value;
523static void rna_RigidBodyCon_override_solver_iterations_set(
PointerRNA *
ptr,
bool value)
530 if (rbc->physics_constraint) {
532 rbc->num_solver_iterations);
537 rbc->flag &= ~RBC_FLAG_OVERRIDE_SOLVER_ITERATIONS;
539 if (rbc->physics_constraint) {
547static void rna_RigidBodyCon_num_solver_iterations_set(
PointerRNA *
ptr,
int value)
551 rbc->num_solver_iterations = value;
562static void rna_RigidBodyCon_do_set_spring_stiffness(
RigidBodyCon *rbc,
582static void rna_RigidBodyCon_spring_stiffness_x_set(
PointerRNA *
ptr,
float value)
593static void rna_RigidBodyCon_spring_stiffness_y_set(
PointerRNA *
ptr,
float value)
604static void rna_RigidBodyCon_spring_stiffness_z_set(
PointerRNA *
ptr,
float value)
615static void rna_RigidBodyCon_spring_stiffness_ang_x_set(
PointerRNA *
ptr,
float value)
626static void rna_RigidBodyCon_spring_stiffness_ang_y_set(
PointerRNA *
ptr,
float value)
630 rbc->spring_stiffness_ang_y = value;
637static void rna_RigidBodyCon_spring_stiffness_ang_z_set(
PointerRNA *
ptr,
float value)
641 rbc->spring_stiffness_ang_z = value;
649static void rna_RigidBodyCon_do_set_spring_damping(
RigidBodyCon *rbc,
669static void rna_RigidBodyCon_spring_damping_x_set(
PointerRNA *
ptr,
float value)
680static void rna_RigidBodyCon_spring_damping_y_set(
PointerRNA *
ptr,
float value)
690static void rna_RigidBodyCon_spring_damping_z_set(
PointerRNA *
ptr,
float value)
700static void rna_RigidBodyCon_spring_damping_ang_x_set(
PointerRNA *
ptr,
float value)
711static void rna_RigidBodyCon_spring_damping_ang_y_set(
PointerRNA *
ptr,
float value)
715 rbc->spring_damping_ang_y = value;
721static void rna_RigidBodyCon_spring_damping_ang_z_set(
PointerRNA *
ptr,
float value)
725 rbc->spring_damping_ang_z = value;
731static void rna_RigidBodyCon_motor_lin_max_impulse_set(
PointerRNA *
ptr,
float value)
735 rbc->motor_lin_max_impulse = value;
740 static_cast<rbConstraint *
>(rbc->physics_constraint), value, rbc->motor_ang_max_impulse);
745static void rna_RigidBodyCon_use_motor_lin_set(
PointerRNA *
ptr,
bool value)
752 if (rbc->physics_constraint) {
760static void rna_RigidBodyCon_use_motor_ang_set(
PointerRNA *
ptr,
bool value)
767 if (rbc->physics_constraint) {
775static void rna_RigidBodyCon_motor_lin_target_velocity_set(
PointerRNA *
ptr,
float value)
779 rbc->motor_lin_target_velocity = value;
785 rbc->motor_ang_target_velocity);
790static void rna_RigidBodyCon_motor_ang_max_impulse_set(
PointerRNA *
ptr,
float value)
794 rbc->motor_ang_max_impulse = value;
799 static_cast<rbConstraint *
>(rbc->physics_constraint), rbc->motor_lin_max_impulse, value);
804static void rna_RigidBodyCon_motor_ang_target_velocity_set(
PointerRNA *
ptr,
float value)
808 rbc->motor_ang_target_velocity = value;
813 rbc->motor_lin_target_velocity,
820static void rna_RigidBodyWorld_convex_sweep_test(
RigidBodyWorld *rbw,
823 const float ray_start[3],
824 const float ray_end[3],
845 "A non convex collision shape was passed to the function, use only convex "
853 "Rigidbody world was not properly initialized, need to step the simulation first");
856 UNUSED_VARS(rbw, reports,
object, ray_start, ray_end, r_location, r_hitpoint, r_normal, r_hit);
879 srna,
"Rigid Body World",
"Self-contained rigid body simulation environment and settings");
889 prop,
"Collection",
"Collection containing objects participating in this simulation");
897 prop,
"Constraints",
"Collection containing rigid body constraint objects");
923 "Substeps Per Frame",
924 "Number of simulation steps taken per frame (higher values are more accurate "
935 prop,
nullptr,
"rna_RigidBodyWorld_num_solver_iterations_set",
nullptr);
939 "Number of constraint solver iterations made per simulation step (higher values are more "
940 "accurate but slower)");
950 "Reduce extra velocity that can build up when objects collide (lowers simulation "
951 "stability a little so use only when necessary)");
958 prop,
"rna_RigidBodyWorld_PointCache_get",
nullptr,
nullptr,
nullptr);
970 func =
RNA_def_function(srna,
"convex_sweep_test",
"rna_RigidBodyWorld_convex_sweep_test");
972 func,
"Sweep test convex rigidbody against the current rigidbody world");
975 func,
"object",
"Object",
"",
"Rigidbody object with a convex collision shape");
990 "The hit location of this sweep test",
1002 "The hit location of this sweep test",
1014 "The face normal at the sweep test hit location",
1025 "If the function has found collision point, value is 1, otherwise 0",
1039 srna,
"Rigid Body Object",
"Settings for object participating in Rigid Body Simulation");
1055 prop,
"Mesh Source",
"Source of the mesh used to create collision shape");
1071 prop,
"Collision Shape",
"Collision Shape of object in Rigid Body Simulations");
1079 prop,
"Kinematic",
"Allow rigid body to be controlled by the animation system");
1106 "Enable Deactivation",
1107 "Enable deactivation of resting rigid bodies (increases performance and stability "
1108 "but can cause glitches)");
1114 prop,
"Start Deactivated",
"Deactivate rigid body at the start of the simulation");
1125 "Linear Velocity Deactivation Threshold",
1126 "Linear Velocity below which simulation stops simulating object");
1136 "Angular Velocity Deactivation Threshold",
1137 "Angular Velocity below which simulation stops simulating object");
1147 prop,
"Linear Damping",
"Amount of linear velocity that is lost over time");
1156 prop,
"Angular Damping",
"Amount of angular velocity that is lost over time");
1177 "Tendency of object to bounce after colliding with another "
1178 "(0 = stays still, 1 = perfectly elastic)");
1188 "Use custom collision margin (some shapes will have a visible gap around them)");
1200 "Threshold of distance near surface where collisions are still considered "
1201 "(best results when non-zero)");
1209 prop,
"Collision Collections",
"Collision collections rigid body belongs to");
1222 "Rigid Body Constraint",
1223 "Constraint influencing Objects inside Rigid Body Simulation");
1253 prop,
"Disable Collisions",
"Disable collisions between constrained rigid bodies");
1275 prop,
"Breakable",
"Constraint can be broken if it receives an impulse above the threshold");
1285 "Breaking Threshold",
1286 "Impulse threshold that must be reached for the constraint to break");
1294 "Override Solver Iterations",
1295 "Override the number of solver iterations for this constraint");
1306 "Solver Iterations",
1307 "Number of constraint solver iterations made per simulation step (higher values are more "
1308 "accurate but slower)");
1495 prop,
nullptr,
"rna_RigidBodyCon_spring_stiffness_ang_x_set",
nullptr);
1505 prop,
nullptr,
"rna_RigidBodyCon_spring_stiffness_ang_y_set",
nullptr);
1515 prop,
nullptr,
"rna_RigidBodyCon_spring_stiffness_ang_z_set",
nullptr);
1548 prop,
nullptr,
"rna_RigidBodyCon_spring_damping_ang_x_set",
nullptr);
1557 prop,
nullptr,
"rna_RigidBodyCon_spring_damping_ang_y_set",
nullptr);
1566 prop,
nullptr,
"rna_RigidBodyCon_spring_damping_ang_z_set",
nullptr);
1576 prop,
nullptr,
"rna_RigidBodyCon_motor_lin_target_velocity_set",
nullptr);
1586 prop,
nullptr,
"rna_RigidBodyCon_motor_lin_max_impulse_set",
nullptr);
1596 prop,
nullptr,
"rna_RigidBodyCon_motor_ang_target_velocity_set",
nullptr);
1606 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)
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)
Object groups, one object can be in many groups at once.
Object is a sort of wrapper for general info.
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_inherit_refine(const PointerRNA *ptr, StructRNA *type, void *data)
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_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t bit)
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)
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_array(PropertyRNA *prop, int length)
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
void WM_main_add_notifier(uint type, void *reference)