Advice on instantiation, organization, and rigid body joints

I’ve just recently got into the BGE, and I’m having trouble wrapping my head around some aspects of it.

My issue is that I have created rigid body object that propels itself around an orbit by basically being chained to the center via a rigid body joint. The set up is a bit like this: anchor object >rigid body joint> pivot object >rigid body joint> thrust object. Together, they form a neat little ball-and-chain-like system.

I want to organize them under an empty so that they aren’t scattered about the outliner, but gathered in under a single location.

It seems that doing this disables the physics of children. I’ve read some other threads about how this is an intended behavior because the top level object is the physics object. I’m used to other 3D game engines where parenting under an empty simply gives the children a new local world space.

Am I missing something here? Is this really an intended behavior, and well… should it be?

Ultimately, my goal is to have this neat little chain of objects be instantiated into the scene from another ‘assets’ scene. Do I simply have to instantiate all three objects individually? And if so, how to do I maintain the links in the constraints?

This brings me to another issue. I tried to begin using the dupligroup instantiation (I thought this would be a solution.) I took the three objects, and moved them to an ‘assets’ scene and grouped them. I tested their physics in this ‘assets’ scene and saw that they worked. In the test scene, I created an empty meant to act as a dupligroup. I set it to dupligroup the group. I saw the instantiation in the test scene. I pressed “P” and insta-crash with no logging or post-crash report at all.

To recap:
How can I organize objects connected by rigid body joints so they are not scattered in the outliner?
How can I instantiate such a group of objects while maintaining constraint targets?

Can anyone detect and share some best practice deficiencies I’m having? IE - what is the better way to do things?

Thanks!

  1. I’m not sure about organizing objects so they’re not scattered in the outliner. I honestly only use it if I’m trying to find something that I can’t visually see in my scene or that I forgot about. Your idea of using the outliner and keeping things “grouped together” sounds interesting and useful, though.

  2. In my version, Blender doesn’t crash when I add a group instance of a group with physics constraints-enabled objects, but the objects just act as though there aren’t any constraints. It would appear that this is a bug. I would recommend reporting it to the bug tracker here with the Game Engine project selected in the report. In the meantime, you should be able to use Python API to set up your constraints dynamically in-game.

  3. Best practice kind of depends on what exactly you’re trying to accomplish. Your little test seems like it could be done just by parenting an object (the “rocket”) to a object and rotating that “center point”.

Parenting in the BGE means wholly and complete copying of the parent object’s position, rotation, and scaling, but offset (of course). If you vertex parent an object to another, then the parented object will copy just the parent’s position, taking into account its own offset from the parent. Parenting basically overrules the physics engine (Bullet), so you can’t, for example, parent a rigid body cube to a large landmass, or it won’t be able to drop or be moved by Bullet. If you need the physics-enabled object to take into account a “parent’s” position, rotation, and scaling, then you’ll have to enforce that yourself via Python code.

Thanks for the reply, SolarLune.

  1. It actually seems quite foreign to me to not be able to organize the scene in the outliner like this. In every game engine I’ve used previously, this was easily done.

2)Which version, specifically? I’m using 2.70a. Did you try it specifically with the rigid body joint constraint? I will try an isolated test case and see what happens.

  1. Unfortunately, I need the physics simulation for this. The objects are meant to orbit and collide about a spherical play field and react to one another. You could imagine it as a big omni-directional Newton’s Cradle in 3D with no gravity. Even if I tried to just use parenting-- since the physics simulation is overriden on child objects, I wouldn’t be able to get any kind of attitude adjustment on my thrust object (using physics, at least.)

The parenting seems like a typical parent child relationship with the child essentially having their own local coordinate system transformed in relation to the parent. Why the Bullet physics engine couldn’t be applied from this new frame of reference is beyond me. I’ve never seen behavior like this before in any physics enabled engine I’ve used before.

I’ll keep digging… and also I’ll give the dupligroup instancing another try.

Thanks again.

EDIT: I was able to see the dupligroup working in a pared down blend file.