I'd like to enable the rigid body settings for a set of objects, and I don't want to use bpy.ops.rigid_body.object_add(). I see that objects have the property object.rigid_body, which is read-only. So how do I create the rigid body settings, and assign them to object.rigid_body?


2 Answers 2


This question is related to How do I add a rigidbody to an object with python?.

In 2.8 you need to use collections, so if you want to add rigid body physics to object my_object for scene 'Scene':


and verify outcome with

my_object.rigid_body is not None
  • $\begingroup$ @batFINGER I updated the variable name to my_object. Thanks. $\endgroup$
    – Dazotaro
    Apr 10, 2019 at 21:33
  • 1
    $\begingroup$ Finally, the right answer! The accepted answer to the linked question is outdated. $\endgroup$ Sep 2, 2022 at 6:35

This seems to have changed recently in 2.90, and I could only find a workaround by talking to folks in discord. Here's a complete snippet for code that works to create rigid body objects in Blender:

import bpy

bpy.ops.mesh.primitive_monkey_add(size=2, enter_editmode=False, align='WORLD', location=(0, 0, 5), scale=(1, 1, 1))
suz = bpy.context.object

bpy.ops.mesh.primitive_plane_add(size=10, enter_editmode=False, align='WORLD', location=(0, 0, 0), scale=(1, 1, 1))
plane = bpy.context.object

sc = bpy.context.scene
sc.rigidbody_world.enabled = True

collection = bpy.data.collections.new("MyTestCollection")

sc.rigidbody_world.collection = collection

plane.rigid_body.type = 'PASSIVE'


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .