- Home /
Make objects invisable when they are passing through
Hi! I'm working on an open world continuation of my previous game Roundabout, you should look at the trailer to get a better idea of what i'll be talking about: https://play.google.com/store/apps/details?id=com.DaneGillis.RoundaboutFree
All enemies are made out of the same "special" material like the walls which in the game would allow them to pass through them, fuse with them but then "re-emerge" and continue moving or another use would be to have them enter the wall, becoming invisable transitionally and then destroy them when they have "dissapeared" completely, making it seem like they merged with the wall.
To achieve this effect i'd need something like a mask but the other way around, instead of hiding objects that aren't in a certain area, i'd need to hide objects or parts of it when they enter an area and have them become visable again while leaving.
The problem is that i don't know where to begin making something like this and it's a pretty specific thing so i can't find it on google, i'm hoping to get some tips on how to hide the objects in this way.
Thanks in advance.
@ShadyProductions yeah you're right but i'm looking more for tips regarding how to hide the objects, i'll update my question thanks
disable them for sometime? gameObject.SetActive(false);
? I don't quite understand what you mean with hide them..
what you described would definitely hide the objects, the player wouldn't see them when they enter the wall but this way the entire object would turn invisable OnTriggerEnter but it wouldn't happen transitionally, i need it to slowly become invisable, if half of the object is in the wall then only that half should be invisable and the other half is still visable while it's still entering the wall. i want to create a merging effect, as if the enemy object and the wall fuse into one and then later the enemy object would leave the wall again, with only the parts that have exited turning visable while the rest is still invisable. I'm probably not explaining it very well and i do apologize for that, english isn't my first language but take a look at what mask does, when an object is half into the mask area, only the part inside the mask area is shown and the rest is invisable, well this is what i want to do but the other way around, only the parts outside of the area should be shown, this way i would be able to place "cloak" areas on the map.
Answer by ConsoleHack000 · Jan 03, 2016 at 09:03 AM
You can do this by disabling the Mesh Renderer when you are inside a wall (OnTriggerEnter) , and then re-enabling it when you are outside the wall (OnTriggerExit I believe)
that would be an easier solution and i may be able to use that too but i don't think this would allow me to transitionally hide the objects, they would turn invisable instantly which wouldn't create the "merging" effect that i'm looking for, thanks for your answer though!
Answer by dilippatil · Jan 03, 2016 at 08:24 PM
You can try fadeout/ fadein transition by playing with that objects materials alpha value in color attribute by selecting appropriate shader(which will support transparency). If u want particular part of that object should be visible/invisible, I am sure you can achieve it through shaders alpha value/transperience attribute. As well as u can witre your woun shader to do translation . I hope this will guide you to what you are looking for.
Your answer
Follow this Question
Related Questions
moving player top down,movement in unity 2d 0 Answers
How to make a sprite respond to a specific color? 0 Answers
Stuttering in simple 2D game using interpolation? 1 Answer
When 2D Car Turns Upside Down, Game Over Scene Should appear. 1 Answer
Why Is there A slight jitteryness on player movement and camera? 0 Answers