How to set Collision Bounds in Python?

Hi everyone

I’m experimenting with a script that place 100 balls in a scene and the idea is to drop them with the game engine, the script is below.

I figured out how to set physics to “Rigid Body” and the bound type to “Sphere”, but how do you activate the “Collision Bounds”, i.e. how do you tick that box in the Physics Tab, red circle in the attached image?

Any help and ideas here will be appreciated.

/John

Here is the script:

import bpy
for yy in range (-10,10,2):
for xx in range (-10,10,2):

bpy.ops.mesh.primitive_uv_sphere_add(segments=32, ring_count=16, size=1, view_align=False, enter_editmode=False, location=(xx, yy, 10))

    for obj in bpy.context.selected_objects:
        obj.game.physics_type = "RIGID_BODY"
        obj.game.collision_bounds_type = "SPHERE"


or link to MediaFire:

http://www.mediafire.com/imageview.php?quickkey=dq34cpjh2aae9so&thumb=6

obj.game.use_collision_bounds = True

API link

A link to the .blend file is here http://www.mediafire.com/?dmkaodcawrw6t08

Thanks teldredge, that solves the problem…

I used the script above and dropped 800 balls on a plane, you can see the animation here

http://www.youtube.com/watch?v=yRJn3JewYXs

It looks like the balls are penetrating into the plane… it is a bit unexpected, or I’m I missing something here?

Not sure. What happens if you replaced the plane with a thin similar shaped box? Do the balls still penetrate?