diff options
author | Sergej Reich <sergej.reich@googlemail.com> | 2013-02-24 03:04:07 +0400 |
---|---|---|
committer | Sergej Reich <sergej.reich@googlemail.com> | 2013-02-24 03:04:07 +0400 |
commit | c82213359aa8bc2a762dc0a76c813d46c159a291 (patch) | |
tree | 312fc8aa5a246025d8d6d519b83c266d3a2b861a /release | |
parent | 47bd908e014412b4339ca4bca0a3556d9bd7fcd2 (diff) |
rigidbody: Add motor constraint
It's implemented as a separate constraint instead of adding properties
to the existing constraints.
Motors only apply linear and angular impulses and don't limit the
movement of rigid bodies, so it's best to use them in conjunction with
other constraints to limit the degrees of freedom.
Thanks to Markus Kasten (markus111) for the initial patch.
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/startup/bl_ui/properties_physics_rigidbody_constraint.py | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/release/scripts/startup/bl_ui/properties_physics_rigidbody_constraint.py b/release/scripts/startup/bl_ui/properties_physics_rigidbody_constraint.py index e4e5b94407d..a49c6d623ca 100644 --- a/release/scripts/startup/bl_ui/properties_physics_rigidbody_constraint.py +++ b/release/scripts/startup/bl_ui/properties_physics_rigidbody_constraint.py @@ -51,11 +51,12 @@ class PHYSICS_PT_rigid_body_constraint(PHYSICS_PT_rigidbody_constraint_panel, Pa layout.prop(rbc, "object1") layout.prop(rbc, "object2") - row = layout.row() - row.prop(rbc, "use_breaking") - sub = row.row() - sub.active = rbc.use_breaking - sub.prop(rbc, "breaking_threshold", text="Threshold") + if rbc.type != 'MOTOR': + row = layout.row() + row.prop(rbc, "use_breaking") + sub = row.row() + sub.active = rbc.use_breaking + sub.prop(rbc, "breaking_threshold", text="Threshold") row = layout.row() row.prop(rbc, "override_solver_iterations", text="Override Iterations") @@ -113,6 +114,30 @@ class PHYSICS_PT_rigid_body_constraint(PHYSICS_PT_rigidbody_constraint_panel, Pa sub.prop(rbc, "limit_ang_x_lower", text="Lower") sub.prop(rbc, "limit_ang_x_upper", text="Upper") + elif rbc.type == 'MOTOR': + col = layout.column(align=True) + col.label("Linear motor:") + + row = col.row() + sub = row.row() + sub.scale_x = 0.5 + sub.prop(rbc, "use_motor_lin", toggle=True, text="Enable") + sub = row.row() + sub.active = rbc.use_motor_lin + sub.prop(rbc, "motor_lin_target_velocity", text="Target Velocity") + sub.prop(rbc, "motor_lin_max_impulse", text="Max Impulse") + + col.label("Angular motor:") + + row = col.row() + sub = row.row() + sub.scale_x = 0.5 + sub.prop(rbc, "use_motor_ang", toggle=True, text="Enable") + sub = row.row() + sub.active = rbc.use_motor_ang + sub.prop(rbc, "motor_ang_target_velocity", text="Target Velocity") + sub.prop(rbc, "motor_ang_max_impulse", text="Max Impulse") + elif rbc.type in {'GENERIC', 'GENERIC_SPRING'}: col = layout.column(align=True) col.label("Limits:") |