I’m struggling to find examples of how to manage collision profiles in code. With blueprints, there are checkboxes that let you specify that “walls” block “bullets” but “bullets” ignores other “bullets”, etc… Very convenient.
In code, though, all I’ve found so far is
SetCollisionObjectType(): sets the collision profile for a mesh component
SetCollisionResponseToChannel(): sets a mesh component’s response to a particular channel
But how do I specify, in code, that all “bullets” should ignore other “bullets,” and so on? I guess I could set the response for every single mesh, but that seems really inefficient, both in coding time and execution time.
I just thought maybe there was a way to set the response based on channel, as opposed to doing it for every single component. I mean, I might have 50 types of bullets and 50 types of walls. It would be nice if I could just say, globally, that all walls block bullets, etc, rather than having to do it in every constructor for every bullet and wall component.
I know this is a super old post but for anyone that comes looking for this: if you have all your bullets inheriting from a single parent, put this guy in the parent:
Then make a function in your child class that returns that capsule component so you can put this in your child bullets if you want specific bullets to block others -