Should i be able to add gameobjects as children to a parent with a rigidbody?

I've come across this in my main project, and have managed to recreate the problem in a small test project that I'm about to send to unity. I'd put it here but there doesn't seem to be away to add attachments (probably for the best).

Anyways, the simple case is basically a dumbell sort of shape made out of a central cube handle, with a sphere on each end. Something that looks a bit like this

0========0

either side of this object i've placed two other objects, both a cube with a sphere on top. So the setup looks a bit like this, I've labeled the parts, 1-5 beneath the diagram

enter code here

 o               o
[ ] 0=========0 [ ] 
 1  2    3    4  5

These parts are

  • 1,5
    • cube + sphere
    • cube collider
    • rigid body
  • 2
    • spheres positioned to be on the ends of the dumbbell
    • sphere collider, trigger, no rigidbody
    • crucially they're setup in the root of the scene, NOT as children of the dumbbell
  • 3
    • dumbbell cube

I've got 3 scripts in the world.

  • RotateMe
    • added to the dumbell cube (part 3)
    • has a useRigidBody parameter
      • if set creates a kinematic rigid body in the gameobject and uses it to rotate it
      • if not set no rigidbody is created and the gameobject is just rotated via its transform rotation
  • Detect Me
    • added to the detector parts (parts 1 and 5)
    • implements trigger enter and leave
      • on enter and leave it moves the sphere part so you can tell a trigger has entered/left
  • Manager
    • within its start() it adds the two dumbbell ends (parts 2 and 4) into the dumbbell (part 3) as children

This setup allows me to easily turn the dumbell into something that rotates either via the rigidbody or just using the transform.

From this I have discovered that when the rigidbody is used to rotate the dumbbell the sensors on its end do not update properly. They appear where they should be in the 3d view but the sphere colliders themselves don't appear where the actual spheres appear to be. As such the sensors either end have no reaction when the visible spheres pass through them.

However, when the transform is just being used everything lines up.

As an aside if the spheres are in the dumbell hierarchy in the editor then it also works fine.

As such it appears to be that adding the sphere collider children to the parent that has a rigidbody is somehow not working properly. The spheres appear to move as part of the parent but their colliders don't.

Anyone got any thoughts on this?

Cheers

While I don't fully understand the setup from your description, there is indeed a bug in Unity 2.6, which affects children of kinematic rigidbodies not properly updating their positions when the rigidbodies move, which will be fixed in 3.0. Have you reported this as a bug with a project folder? If so please let me know the case number, then I can confirm whether the 3.0 fix solves this or not.