0
$\begingroup$

I would like to have multiple objects moving as one in Blender Game Engine. For that I created a blend-file with the Objects and grouped them.

In my game-blend I linked this group from the blend file which brings the objects into my game. Now I would like to move this group on keystroke. For that I created a Sensor and Actuator. But my objects are not moving.

But: I have my camera tracked to that group. By that I can see that the object are not moving, but the camera is moving to the side just I would expect the camera to track my group of objects.

Could someone please point me to where I made a mistake?

$\endgroup$
  • $\begingroup$ Be aware: There are no explicit groups within the BGE. Group members are just a bunch of single objects. You can instantiate a group from within Blender. The instance remains within the BGE and can be replicated (via AddObject on the instantiating object). $\endgroup$ – Monster May 16 '17 at 4:09
1
$\begingroup$

An instance of a group is pretty much the same as an empty that adds the object in the first frame. As such, there is no relationship between a group owner and the group members unless you create one using code. Attach this to the parent of the group (I assume they are parented together to one object). Be aware that physics may not do what you expect as now the physics is associated with the empty that added the group.

import bge
cont = bge.logic.getCurrentController()
own = cont.owner

if own.groupObject is not None:
    own.setParent(own.groupObject)
else:
    print("This script isn't attached to something that is part of a group instance")
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.