Example scene for physics collision
Run the script to get the scene.
import bpy
# select and delete all object
if bpy.context.object:
bpy.ops.object.mode_set(mode='OBJECT')
bpy.ops.object.select_all(action = "SELECT")
bpy.ops.object.delete(use_global=True, confirm=False)
unit_settings = bpy.context.scene.unit_settings
unit_settings.system = 'METRIC'
unit_settings.scale_length = 1
unit_settings.length_unit = 'METERS'
unit_settings.mass_unit = 'KILOGRAMS'
unit_settings.time_unit = 'SECONDS'
bpy.context.scene.use_gravity = True
bpy.context.scene.gravity[0] = 0
bpy.context.scene.gravity[1] = 0
bpy.context.scene.gravity[2] = -9.81
bpy.ops.mesh.primitive_plane_add(size=5, enter_editmode=False, align='WORLD', location=(0, 0, 0), scale=(1, 1, 1))
bpy.context.object.name = "floor"
bpy.ops.rigidbody.object_add()
bpy.context.object.rigid_body.type = 'PASSIVE'
bpy.context.object.rigid_body.collision_shape = 'BOX'
bpy.ops.mesh.primitive_cube_add(size=5, enter_editmode=False, align='WORLD', location=(5, 0, 0), scale=(1, 1, 1))
bpy.context.object.name = "wall"
bpy.ops.rigidbody.object_add()
bpy.context.object.rigid_body.type = 'PASSIVE'
bpy.context.object.rigid_body.collision_shape = 'BOX'
bpy.ops.mesh.primitive_cube_add(size=0.2, enter_editmode=False, align='WORLD', location=(0, 0, 0.101), scale=(1, 1, 1))
bpy.ops.rigidbody.object_add()
bpy.context.object.rigid_body.type = 'ACTIVE'
bpy.context.object.rigid_body.collision_shape = 'BOX'
bpy.ops.rigidbody.mass_calculate(material='Iron', density=7874)
bpy.ops.object.empty_add(type='CIRCLE', align='WORLD', location=(-0.41, 0, 0), rotation=(0, 1.5708, 0), scale=(1, 1, 1))
bpy.context.object.name = "force"
bpy.ops.object.forcefield_toggle()
bpy.context.object.field.type = 'WIND'
bpy.context.object.field.strength = 100000