"set actor enable collision" does not turn off collision for child actors

Hi.

So read that the proper way to turn on/off collision for a whole actor is to use “set actor enable collision”.

I’ve tested it in a simple actor and it works fine for everything except child actors.

So my question is, is this a bug or the way it’s intended to work?

And if this is not a bug, how is this intended to be used? Is there an event/callback to the actor when something turns on/off it’s collision, so that I can do the same thing internally for it’s childs?

Child Actors are not “really” Children. They are just Actors attached to the parent. That means they are fully functional on their own.

To retrieve the Children you use ChildActorComponent->getChildActor and disable the Collision from them, too.

I see your solution, but I don’t buy the argument :slight_smile:
My guess is that the this is really a bug.

Taking into account that “Set Actor Hidden In Game”

does manage to set all childs hidden as well.

And there is really no purpose in having such a ‘feature’ (too only turn off collision for the ‘main’ actor.), unless you are doing some weird designs of your game-system.

Did you ever find a solution for this? Very frustrating being able to hide an object and its children, but having the collision remain for the children only.

I have to imagine this is a mistake, but even in Unreal 5 the “set collision enabled” node does not have an option to propagate to children while visibility does.

You could also use ‘get child components’ except that it returns an array, which is not compatible input for the set collision node.

You can write recursive function that takes actor on input.
Execution would be:

  1. Set actor collision
  2. Get actor children (array)
  3. Run for each loop on that array, calling the same function on each child

That way you will affect whole hierarchy

1 Like