Hi.
I have 5 Balls with 5 different Colors. A TriggerBox is available. How I can find out to perform future Operations, which Color is overlapping the TriggerBox?
Hi.
I have 5 Balls with 5 different Colors. A TriggerBox is available. How I can find out to perform future Operations, which Color is overlapping the TriggerBox?
You can add actor tags to your balls (make sure they are actor type tags) from the details panel of your assets. For example, add an actor tag named “red” to your red ball. Then, get an “Actor Has Tag” node and plug it into the “other actor” pin of your On Component Begin Overlap node, and detect if the hit actor is red or not (or any other color) then continue the execution by branching the desired outcomes using branch nodes
Oh wow, seems like this will work.
Maybe not a efficient solution!? But it works. Thank you
I explained the most basic way but you could also create an enum with the colors you want and plug that into a “Switch on Enum” node if you’re looking for a more practical code.
You could technically switch on tag since they’re Name
s:
But enums are neater, and you do not risk typos.
Another way is to use a tMap
association - Name | WhateverYouWant
. Finding in a map is fast, no iteration.