Ok so basically what i want to do is : i got the player that can switch colors to red, blue, green, etc. I have a red laser door that i want to disable collision on, when the player is red so basically when key 1 is pressed, the player becomes red and door collision is disabled and re enabled when any other button is pressed that changes the color.
Question is, how exactly do i do this? If i add another “event begin play” in the laser door blueprint it will just disable the collision at start and also for some reason i lose the ability to turn the player into red anymore.
And as a second question : Is it maybe possible as an alternative to make the collision be disabled by detecting the parameter value of the player body material ?
One way is to change the collision of the doors themselves through the Character BP. I’d do it this way: create an Enumerator with values with names of carious colors. In the Door BP, create a variable of the created Enum type. Expose it to be able to change in in viewport.
In the Character BP (you can use the same Enum to set the color, btw), when you change the Character Color, do this:
Of course, you’ll have to add your actual color change somewhere there, too.
And with the Enum variable, you can easy set up a function in the Door Construction Script so that if would change color in the viewport when you select one in the dropdown menu.
Another way is to create actual collision channels in the Project Settings. If you have like 3 or 4 colors, that won’t be a problem. Then the function in the Character BP will be very simple: when character color is changed to Red, set the Capsule Collision response to Ignore Red and Block the rest, and so on.
I am trying the second method to no avail, i am quite new to UE 4 so the first method might be a bit too much for me to understand for the moment since i also have no idea how to create this :
But i am assuming i had to created “object” channels and not “trace channels” in the project settings, which i did.
Does the second method require me to do anything in the door BP or it can all be done in the character BP?
So far i have this :
So at the red part i did manage to make it so that when i do press the 1 key , my character turns red and he starts falling through the map, which is more or less progress for a beginner like me since i managed to make at least the level collision be disabled, now i need to understand how to apply it to the door.
For clarification sake, the door is made out of a frame and “Laser 1” and “Laser 2” components, those are the ones that i want to apply the collision enabling/disabling to.
First, go to Edit → Project Settings → Engine → Collision and add the required number of Object Channels:
Next, set the respective object types to your lasers (if it’s third person, set them to ignore camera, too):
Then, change the response to channel for the character capsule component:
And [here]'s what happens.
I have completely forgot about the fact that i need to change the actual component custom collision and was more obsessed of doing this purely from blueprints (don’t know why).
In any case, thank you for your quick response and explanation.
I wish you only the best.
As for the first option: right click in the content browsers and create an enumeration. Call it, say, “Enum_Colors”:
In it, click new and add the required number of options:
Then in any BP you can create a variable of this enumeration type: