Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Question about camera, fog and water!

Discussion in 'Scripting' started by Maxske, Jul 22, 2015.

  1. Maxske

    Maxske

    Joined:
    Feb 20, 2015
    Posts:
    37
    Hi i was wondering how i would go about solving this problem. In my game, when the player goes into water and goes under the water level variable, the fog turns blue. But when my player floats to the top of the water, the fog changes to white since he is out of water. But since there are waves, the water sometimes goes over my player and i see all of the underwater with a white fog.

    Is there a way to have two fogs at the same time? Like if you are above water but can periodically see underwater at the same time?
     
  2. raidho36

    raidho36

    Joined:
    Jan 4, 2014
    Posts:
    3
    In script that changes fog color, there's a check for water level. It seems like you're using a constant for this, which obviously doesn't matches dynamic water nature. So you just change this constant with a function that checks true water level in that specific point. If your water surface is defined by function, you can use just the same function for the check.
     
  3. Maxske

    Maxske

    Joined:
    Feb 20, 2015
    Posts:
    37
    when you use UNITYS advanced water, the position of the water doesnt change, the water just moves with waves so how do i go about coding that. I understand what you mean but if the water is technically still at a fixed point, i dont know how to code the position of it when there are waves since its a fixed position.
     
  4. phoda

    phoda

    Joined:
    Nov 11, 2014
    Posts:
    384
    He is talking that water level changes for player when waves are coming like top of the wave water level is higher and that would not solve your problem.
    In his explanation you would see whole screen blue and if i understand right you want to see top part (out of water) with white fog and bottom part blue? right?
    i dont know answer but maybe someone who knows understands better i hope :p