Post reply

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.
Message icon:

shortcuts: hit alt+s to submit/post or alt+p to preview

Topic Summary

Posted by: Kronnect
« on: November 07, 2020, 05:39:03 PM »


Take a look at the demo scene Fog of War, where the fog is cut when character moves through.

Basically the demo script is doing this:
fog.SetFogOfWarAlpha(Camera.main.transform.position, 16, 0);

Which is setting the fog ttransparency at the camera position, with a radius of 16 and alpha of 0.

You could do something similar in a new script during Update() but instead of camera position simply pass transform.position, and attach that script to your unit.

For performance reason, do not call that method every frame - do that only if the unit has moved certain distance, for example 0.5 meters or so.

Also, you need to properly enable the fog of war in the inspector and assign the size for such fog of war effect in world space.

Hope this helps.
Posted by: faolad
« on: November 07, 2020, 02:00:40 AM »

Hello, I want to recreate what Fog Void does but with Fog of War. Want to have a script that can put on objects and add this well defined radius that will follow them around in an all fog cover map, without making the fog go away after if the object is no longer there. Hope you can help me, Thanks!