playMaker

Author Topic: Turn Off Box Colliders On All Children That Have One?  (Read 1920 times)

westingtyler

  • Sr. Member
  • ****
  • Posts: 277
    • My Video Game Projects Web Site
Turn Off Box Colliders On All Children That Have One?
« on: July 08, 2018, 04:39:38 AM »
Hello. When the zombie enemy is shot and killed, it falls to the ground and stops animating. Then my character looks silly stepping over it because its box colliders are still active. In Resident Evil 2 you can just walk through any dead zombies, so that's good enough for me.

I have box colliders on various body part joints that have random names based on that rig's bone names. I want to turn off all the box colliders on all parts of the zombie body with one action.

So i guess I need an action that cycles downward from the fsm game object into all children in all branches. and if they have a box collider, disable it. if not, ignore that child. keep in mind that zombies may get back up, so their colliders must be able to be re-enabled. (if this action is possible, I'll be back soon to ask for an action to ACTIVATE them all again.)

perhaps a better action would be to do this as a Set Property on all Relevant Children action, and to set it to disable/enable the box collider.

PS. could you also point me in the direction of what I'd do if I wanted the body on the ground to be pushable by the player running up against it? just do nudge it out of the way to get around it. and what about slowing the player down as he/she runs through the floored enemy? how do we check for that? what's the best way to manage that?



djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Turn Off Box Colliders On All Children That Have One?
« Reply #1 on: July 08, 2018, 05:23:40 PM »
Hi.
There is an action called 'Enable Collider' on the Ecosystem which can enable and disable.
Where you can select a type.
And it has also a checkbox Incl Children.

As you want some actions happening maybe have child object with a mesh collider (so it does not get disabled as its not a box) on a simple mesh (like a box) and set that as a trigger (default).

another possibility is after disabling everything, enable one of the main colliders  and use 'Collider Set Is Trigger' and use that one.