3
$\begingroup$

How do you copy things like rigidbody constraints and force fields to other objects?

I made a cell fracture and I would like to give each cell the same constraints and force fields.

Thanks in advance

$\endgroup$
  • $\begingroup$ there is a copy physics settings in the physics tab "on the left" and you can copy constraints "type in space bar copy constraints" and if you enable "copy attribute menu" addon use Ctrl+C $\endgroup$ – Chebhou Feb 14 '15 at 8:14
  • $\begingroup$ @Chebhou yeah it works to search in space bar for it $\endgroup$ – Chickenator Feb 14 '15 at 8:16
  • $\begingroup$ does that solve the problem ? $\endgroup$ – Chebhou Feb 14 '15 at 8:18
  • $\begingroup$ @Chebhou it doesn't work. It changes the settings to existing rigid body constraints but it doesn't add new ones. I need it to copy the setting but also add new ones to where there isn't rigidbody constraint $\endgroup$ – Chickenator Feb 14 '15 at 8:21
2
$\begingroup$

to add force field to all selected objects :

import bpy

for ob in bpy.context.selected_objects :
    bpy.context.scene.objects.active = ob
    bpy.ops.object.forcefield_toggle()

to run the script copy it and paste in the text editor and cick Run Script

  • to copy constraints from one object to others :

enter image description here

  • to copy rigid body constraints select the objects while the active object is the one with constraints and run this script :

    import bpy
    
    Type = bpy.context.active_object.rigid_body_constraint.type
    obj1 = bpy.context.active_object.rigid_body_constraint.object1
    obj2 = bpy.context.active_object.rigid_body_constraint.object2
    use_br = bpy.context.active_object.rigid_body_constraint.use_breaking
    over_itr = bpy.context.active_object.rigid_body_constraint.use_override_solver_iterations
    for ob in bpy.context.selected_objects :
        bpy.context.scene.objects.active = ob
        bpy.ops.rigidbody.constraint_add(type = Type)
        bpy.context.active_object.rigid_body_constraint.object1 = obj1 
        bpy.context.active_object.rigid_body_constraint.object2 = obj2 
        bpy.context.active_object.rigid_body_constraint.use_breaking = use_br 
        bpy.context.active_object.rigid_body_constraint.use_override_solver_iterations = over_itr
    
| improve this answer | |
$\endgroup$
  • $\begingroup$ sorry I don't understand how python works or how to add a script. And how would it work to add constraints to every object? $\endgroup$ – Chickenator Feb 14 '15 at 8:39
  • $\begingroup$ you can add constraints with the copy option that i gave you in the comment, this answer is to add forcefield only $\endgroup$ – Chebhou Feb 14 '15 at 8:43
  • $\begingroup$ i will edit to include the constraints $\endgroup$ – Chebhou Feb 14 '15 at 8:44
  • $\begingroup$ It's not working. I have the active object as the one with constraints but it still doesn't add constraints to the other object. It just only has the rigidbody setting in the physics tab and no rigid body constraint $\endgroup$ – Chickenator Feb 14 '15 at 8:53
  • 1
    $\begingroup$ ok , i'll edit to include the physics constraints $\endgroup$ – Chebhou Feb 14 '15 at 8:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.