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

Having trouble with camera position

Discussion in 'Editor & General Support' started by jackjustjack, Aug 8, 2015.

  1. jackjustjack

    jackjustjack

    Joined:
    Aug 8, 2015
    Posts:
    3
    Hello everyone,
    as specified in the title, I am trying to reposition my camera after a click, but I do not know how to set the correct position and rotation in order to show exactly what I want on the screen. I mean, I know I can mess with with the rotation, position, but I just can't achieve the desired result.
    Basically, what I want is, when I click, to change from top-down view to a side view. That is all.
    I tried to manually set the position and rotation, but didn't work as expected because the main object (outlined in the picture) was positioned correctly before changing the point of view, and after changing, it wasn't - actually it still where I want, but the camera, due to the rotation, isn't showing it where I want on the screen.

    About the code, I tried something like:

    Code (JavaScript):
    1. function Update () {
    2.     if (Input.GetMouseButtonDown (0)) {
    3.         //Change position to A
    4.         //Change rotation to A
    5.     }
    6.     else if (Input.GetMouseButtonDown (1)) {
    7.         //Change position to B
    8.         //Change rotation to B
    9.     }
    10. }
    Thank you in advance
     

    Attached Files:

    • xd.png
      xd.png
      File size:
      69.2 KB
      Views:
      734
  2. jackjustjack

    jackjustjack

    Joined:
    Aug 8, 2015
    Posts:
    3
    Forget it.
    Solved my problem.