Don’t be frustrated, that’s just part of the learning process we all went through at a certain point.
Here are few pointers for you:
- Create a static mesh actor blueprint which contains the mesh (let’s say a cube) whose material you want to change
- Add a collision box volume around it, make it larger than the contained mesh. Make sure it is set to generate overlap events and is set to OverlapAllDynamics
- Select the collision box and right click in the Event Graph, look for the On Begin Overlap Event. This is the event that is triggered every time another actor “enters” the collision box.
- When the Begin Overlap event is triggered, you have to check that the actor entering the volume is one of the motion controllers. You do that by Casting to BP_MotionController and checking that the cast is successful. If the cast is successful, set a boolean variable bIsOverlapping? to True, otherwise set it to False. The value of the variable should be False to start with.
- Define also the On End Overlap Event for the trigger volume and when it fires set the bIsOverlapping? variable to False.
Now the tricky part.
Once the overlap has happened (bIsOverlapping? is True) you want to change material using the B button, which is Motion Controller (R) Facebutton 2. In principle the input events should be processed by the Motion Controller itself or by the Pawn, but then you would need a way to communicate to the cube actor that the button as been pressed. You could do this with an interface, but that is adding an extra level of complexity for you.
Let’s instead have each cube actor receive the Motion Controller (R) Facebutton 2 event and, if bIsOverlapping? is True, change the material of the corresponding static mesh.
- Add a Motion Controller (R) Facebutton 2 input event to the cube actor
- Click on the Event and uncheck Consume Input. This will ensure all cube actors receive that input and not just the first one on the input stack
- In the Details panel of the cube actor, set Auto Receive Input to Player 0
- Out of the Motion Controller (R) Facebutton 2 event, check with a Branch if bIsOverlapping? is True and, if it is, change the cube material (I leave this part to you)
That’s it. Try to implement it and post again here if you face issues.