Announcement

Collapse
No announcement yet.

problem with material swapping sccript

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    problem with material swapping sccript

    Hi,
    I'm working with top down template and I'm trying to create system that hides objects standing between actor and camera. Similar to Diablo system of hiding walls.
    I saw few guides how to do it, but problem i have with those is, i would have to put BP nodes in every single object that can get between actor and camera (unless I'm seriously mistaken). Which in my case, can mean a lot of objects. Not at the same time during game play, but it would be still a lot of work to set it up. So i took some inspiration from those previous guides and attached box mesh to camera spring arm and it detects objects it collides with and applies new material to them. Then BP in Top Down controller On Begin Overlap gets the objects an applies semi transparent material to it. For level objects to function in this system, all i have to do is turn on ‘Generate overlap events’.
    I like this system because it spares me from lot of work but I have few problems with it.

    1 - It applies new material only to 1st ID of each mesh. I have no idea how to make it work on all sub materials.
    2 - I don't know how to keep information of original material so BP can restore it back on Overlap End. For now, it applies simple colored mat.

    3 - This one is kinda strange. After detection mesh collides with one object, that object gets new material and become transparent. Then, after player goes away, ti turns solid.
    BUT, if player returns without detection mesh colliding with anything else , it wont turn transparent again. I have to go to collide with another mesh to turn transparent (which then become also one time thing) and then, when i return, mesh turns transparent again. But again, only once until i find something else to collide with.

    Could anyone please point me to solutions for each or any of these problems?



    Thanks,
    H

Working...
X