[Help on]: Problem in Interactive Material Swap!
I'm trying to do interactive material swap option for my demo project. i used "On Begin Cursor (mesh)" to set or change material. so i made those meshes as hidden and made it visible on clicking the main mesh on which the material need to be changed. i also tried to make this possible but the problem is when i hover over those hidden objects location the material keeps changing. i need to change the material only when the object is visible. i tried these blueprint method myself. i'm very new to this blueprint. can you please find the error/wrong process on my method.
Though it might seem counter-intuitive, changing a static mesh's visibility does not automatically change its collision behavior. In other words, just because an object becomes invisible does not mean it automatically stops colliding with other objects or stops interacting with trace tests such as those used by OnBeginCursorOver() to determine whether your cursor is hovering over your mesh.
One way to accomplish what you want to do is to toggle the collision properties of your sphere mesh components along with their visibility so they ignore trace tests while hidden.
To do this, try making a blueprint function (call it ToggleCollision or something) that changes the collision profile for each of your sphere mesh components by using the Set Collision Profile Name node. You can use the profile name "NoCollision" to disable cursor interaction, and the "BlockAll" profile to re-enable cursor interaction. (You may also want to create a new boolean variable to make it easy to know which state you're in, and which to toggle to next.)
As an alternative to all that, and more simply, you can try using combinations of Is Visible nodes and Branch nodes. Put these at the start of your On Begin Cursor Over events to check whether each sphere is visible when the mouse hovers over. Only continue execution (i.e. only change the sofa's material) if the hovered-over sphere is currently visible.
I know the second suggestion is a lot better than the first, but I wanted to mention both to hopefully explain a bit more about why things were behaving unexpectedly in the first place.
Anyway, give that a shot and let us know if it works. Good luck!
answered Nov 20 '18 at 05:50 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here