Search Unity

Spotlight reflects my torchlight

Discussion in 'Scripting' started by lockingkz, Jan 22, 2020.

  1. lockingkz

    lockingkz

    Joined:
    Mar 17, 2015
    Posts:
    74
    Hello everyone,
    i am facing a problem with my torch light keep getting flash by my light.

    I have my flashlight follows my camera via script, then I have my torchlight parents to the camera.
    I also have my flashlight to be offset by the camera by a bit, so whenever I turn left, I can see my torchlight getting reflected by the light.

    Any solution?
     
    Last edited: Jan 22, 2020
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,697
    I'm having trouble visualizing what you are saying. Do you have a short video snippet you can post?
     
    lockingkz, Madgvox and Joe-Censored like this.
  3. lockingkz

    lockingkz

    Joined:
    Mar 17, 2015
    Posts:
    74

    I am sorry for the bad explanation, above is the link and please have a look!
     
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,697
    The simplest solution that comes to my mind is to put the light on the and of the flashlight. Is that possible in your setup?
     
  5. lockingkz

    lockingkz

    Joined:
    Mar 17, 2015
    Posts:
    74
    If I put the light at the end of the object flashlight, when i turn back my player body will block the light, since the flashlight is following the camera.

     
  6. Yoreki

    Yoreki

    Joined:
    Apr 10, 2019
    Posts:
    2,605
    I believe what Kurt meant is that the light source should be a child (and at the front) of your flashlight. Thus it would turn with the flashlight and couldnt illuminate the flashlight itself.
    I'm not entirely sure why the light should be blocked by the player model if it was a child of the flashlight. But the light you attach to your flashlight should probably be a spotlight.
     
  7. lockingkz

    lockingkz

    Joined:
    Mar 17, 2015
    Posts:
    74
    Thanks for all the replies, after several tries, I have decided to make my flashlight parent to my light, it works as I want to. I just forgotten about the offset on the torchlight.