Playmaker Forum

PlayMaker Feedback => Action Requests => Topic started by: Sjones on April 12, 2013, 02:13:00 PM

Title: Set all children's colliders IsTrigger[SOLVED]
Post by: Sjones on April 12, 2013, 02:13:00 PM
I am having problems with triggers, custom meshes and instantiating objects with rigidbodys.

However for the most part I have work arounds for the problems I am having.

The last issue is fixed if I manually set IsTrigger to true when I need it to be, I know that this can be done in PM 1 at a time, however with each object having multiple colliders and then I have multiple objects, I would have to set over 300 colliders properties to IsTrigger = true

So I was wondering if there was an action someone could make to set all child objects colliders (be it box, sphere, mesh etc.) IsTrigger to a bool value.
I am not even sure this is possible but would mean that I would only need to set it for each object and not for each collider for each object.

thanks
Title: Re: Set all children's colliders IsTrigger
Post by: Sjones on April 13, 2013, 12:32:23 AM
found this bit of code on the unity forums

Code: [Select]
foreach (Transform child in transform)
{
   child.collider.isTrigger = false;
}

I am not sure how exactly to use this in PM as I gather this would of been put on an object and then it uses that objects children.

the object would have to be specified within PM and then use the above code.

any help would be fantastic.
Title: Re: Set all children's colliders IsTrigger
Post by: greg on April 13, 2013, 05:07:04 PM
If i have to do mass changes like this i get the objects in an arrayMaker array (search the forums), then use "get next" to loop through all the gameObjects and apply the changes.
Title: Re: Set all children's colliders IsTrigger
Post by: jeanfabre on April 15, 2013, 02:00:27 AM
Hi,

 you also have a custom action for iterating, without the need for arrayMaker, simply use GetNextChild action

bye,

 Jean
Title: Re: Set all children's colliders IsTrigger
Post by: Sjones on April 17, 2013, 08:39:38 PM
thanks guys, with your suggestions I think I have solved my issue.