prefabs childs

Hi,

I have a rigid body prefab, which is composed of several other rigid bodys.
I want to disable the gravity on its childrens.,
This is what i do :

  var myrigids = GetComponents (Rigidbody);
  for (var rig : Rigidbody in rigid_object) 
  {
     rig.useGravity = false;
     rig.detectCollisions = false;   
  }

rigid_object, is the name of the prefab.
What’s wrong with this code ?
thanks,

Bruno

I think the first two lines should be

  var myrigids = GetComponentsInChildren (Rigidbody);
  for (var rig : Rigidbody in myrigids)

–Eric

Thanks Eric, but no deal…, it doens’t work :frowning:
Shouldn’t we have the “rigid_object” variable, that references the “father” of the other rigid bodys be included somewhere in the for loop ?

I also tryed this :

                 var myComponent : Rigidbody = GetComponent("piecec3"); 
                 myComponent.useGravity = false;  		 
                 myComponent.detectCollisions = false;

Didn’t work either…

In that case try

var myrigids = rigid_object.GetComponentsInChildren (Rigidbody);

–Eric

works :wink:

thanks a lot Eric