BigB
November 14, 2008, 10:45pm
1
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
Eric5h5
November 14, 2008, 10:55pm
2
I think the first two lines should be
var myrigids = GetComponentsInChildren (Rigidbody);
for (var rig : Rigidbody in myrigids)
–Eric
BigB
November 14, 2008, 11:04pm
3
Thanks Eric, but no deal…, it doens’t work
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…
Eric5h5
November 14, 2008, 11:18pm
4
In that case try
var myrigids = rigid_object.GetComponentsInChildren (Rigidbody);
–Eric