playMaker

Author Topic: Set all children's colliders IsTrigger[SOLVED]  (Read 4945 times)

Sjones

  • Full Member
  • ***
  • Posts: 203
Set all children's colliders IsTrigger[SOLVED]
« 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
« Last Edit: April 18, 2013, 01:32:27 AM by jeanfabre »

Sjones

  • Full Member
  • ***
  • Posts: 203
Re: Set all children's colliders IsTrigger
« Reply #1 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.

greg

  • Junior Playmaker
  • **
  • Posts: 68
Re: Set all children's colliders IsTrigger
« Reply #2 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.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Set all children's colliders IsTrigger
« Reply #3 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

Sjones

  • Full Member
  • ***
  • Posts: 203
Re: Set all children's colliders IsTrigger
« Reply #4 on: April 17, 2013, 08:39:38 PM »
thanks guys, with your suggestions I think I have solved my issue.