How to group objects in BGE?

Hi all.

How grouping objects works in BGE? I just want to access objects that member of certain group.
I find groupMembers and groupObject attributes in KX_GameObject, but I don’t know how it works.

Hallo ucupumar. A example exists in

Blender Asteroids beta

http://www.blenderartists.org/forum/showthread.php?265252-Blender-Asteroids

You can make any number of objects & apply empties in python logic,add actuator edit and use the object to link multiple empties as the objects can appear at
a certain time or how you set it up.



Apparently it doesn’t. “group” (in groupdMembers-groupObject) in the BGE is “dupligroup” in Blender. The blender’s “group” seems to have no bge counterpart (at least from what I can see inspecting a live KX_GameObject from Blender 2.6)

The game engine preserves the parent-child relationships so you may try by adding an empty and making it the parent of all your grouped objects. Or you can use a dupligroup but i have no idea how that works.

You create a group in blender by assigning an object to a group. You can assign it to multiple groups but this is not necessarily a good idea in the bge. Objects belongging to at least one group are drawn green (in oposite to orange). Think about them like a template.

After you defined the group you can create instances - which are basically copies of the group objects <ctrl a> add group instance.
The instance acts like a single object. To be honest it is a single object ehich acts as a placeholder of the group. It can be any object type. Usually it is an empty.

The bge will add all objects = placeholder + copy of the group objects.

That is all.

You can find much more information in the guide link of my signature. Groups especially the linked ones are very cool!

Thanks for the info. I promise to do my best to read that guide but, let’s face it, this thing that a day has 24 hours is a major drawback: 36 would be way better.
So much stuff to learn, so few time to do it.

@Amhatu, that’s a nice game, but that’s not group example that I’m looking for.
@pgi, maybe you can focus to invent a flux capacitor :wink:
@Monster, Thanks! I’ll take a look to your resource. http://blenderartists.org/forum/images/smilies/sago/biggrin.gif

Okay, solved it. First I need to create an instance of group.
Then, I can get list of group member by accessing my_awesome_group_instance_object.groupMembers
Thanks Monster.