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
  4. Dismiss Notice

Spotlight doesn't follow camera

Discussion in 'AR/VR (XR) Discussion' started by DerScheinriese, Feb 18, 2016.

  1. DerScheinriese

    DerScheinriese

    Joined:
    Feb 18, 2016
    Posts:
    2
    My Spotlight doesn't follow the camera.
    Is there any trick or script to make the spotlight follow the camera?
    In our case the spotlight rotates against the rotation route of the camera.
     
  2. Thomas-Mountainborn

    Thomas-Mountainborn

    Joined:
    Jun 11, 2015
    Posts:
    489
    How is your scene set up? Can you provide us with a screenshot of how the spotlight is attached to the camera? It really is just as simple as attaching the spot light to the camera, so I can't imagine why the rotation would be mirrored.
     
  3. stevenbrent

    stevenbrent

    Joined:
    Nov 22, 2015
    Posts:
    25
    Are you trying to move the spotlight programmatically? If so, can you post the relevant code snippet?

    As Thomas mentioned above, the easiest way to to this is to attach the spotlight to the camera. I'm developing something with a spotlight, and this is what worked for me.
     
  4. DerScheinriese

    DerScheinriese

    Joined:
    Feb 18, 2016
    Posts:
    2
    Thanks for your replies.
    I forgot to mention on main detail, the camera should follow the cardboard camera.
    The scene is a VR view inside an eye. In this special case it is not necessary anymore that the spotlight follows the camera.
    But for future development it would be intersting how it may work correctly.
    With the following screens you can see my settings. I tried to attach the spotlight to any camera but it didn't work as I expected.
     

    Attached Files: