Access object collision group

How to access the game object GameObjectSettings collision_group ?

group = object.gameObjectSettings.collision_group

Says KK_gameobject has no groupd = object.gameObjectSettings.collision_group.

https://docs.blender.org/api/blender_python_api_2_78a_release/bpy.types.GameObjectSettings.html?highlight=collision%20mask#bpy.types.GameObjectSettings.collision_mask

= an object ingame

so - gameObjectSettings

and you get

object.collision_group

i have never used it so can be wrong, but this is my guess

you can also print out all the commands an object or anything has with using dir()

print(dir(object))

This is the what i tried also

if Collision.positive :
for object in Collision.hitObjectList :
print(“object.collision_group”)
print(object.collision_group)

I get error KX_gameobject has no attribute collision_group.

Nevermind, i can use some gameobject property to detect is this is environment objects collision or something else, but this would have been cool to be able to read collision_group.

hi,
with Cotaks code “print(dir( object ))” you can check attributes
try it…
and give a try to “object.collisionGroup” instead of “object.collision_group”

1 Like