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

weard cam Behavior?!

Discussion in 'Editor & General Support' started by Jeremie-de-Vos, Feb 16, 2017.

  1. Jeremie-de-Vos

    Jeremie-de-Vos

    Joined:
    Jun 5, 2015
    Posts:
    120
    Hey,
    wen i make an object a child of the camera (So it will follow)
    It does stretch out or something.
    How can i fix this?!
    Or is it a bug from Unity?!

    I'm using version 5.5

    Normally 2017-02-16_14h44_53.png 2017-02-16_14h47_16.png
    how it now looks wen rotating up.
    2017-02-16_14h44_53.png

    Script i'm using for camlook:
    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. public class Fp_Mouse_Look : MonoBehaviour
    4. {
    5.  
    6.     Vector2 mouseLook;
    7.     Vector2 smoothV;
    8.     public float Sensitivity = 5.0f;
    9.     public float Smoothing = 2.0f;
    10.  
    11.     GameObject Character;
    12.  
    13.     void Start()
    14.     {
    15.         Character = this.transform.parent.gameObject;
    16.     }
    17.  
    18.     void Update()
    19.     {
    20.         var md = new Vector2(Input.GetAxisRaw("Mouse X"), Input.GetAxisRaw("Mouse Y"));
    21.  
    22.         md = Vector2.Scale(md, new Vector2(Sensitivity * Smoothing, Sensitivity * Smoothing));
    23.         smoothV.x = Mathf.Lerp(smoothV.x, md.x, 1f / Smoothing);
    24.         smoothV.y = Mathf.Lerp(smoothV.y, md.y, 1f / Smoothing);
    25.         mouseLook += smoothV;
    26.  
    27.         transform.localRotation = Quaternion.AngleAxis(-mouseLook.y, Vector3.right);
    28.         Character.transform.localRotation = Quaternion.AngleAxis(mouseLook.x, Character.transform.up);
    29.     }
    30. }
     
  2. SarfaraazAlladin

    SarfaraazAlladin

    Joined:
    Dec 20, 2013
    Posts:
    280
    Is the issue that the cube is not at the bottom of the screen? I'm not really seeing any stretch effect from your screenshots.
     
  3. Jeremie-de-Vos

    Jeremie-de-Vos

    Joined:
    Jun 5, 2015
    Posts:
    120
    If you take a closer look you can see the cube is completly out of form
     
  4. Jeremie-de-Vos

    Jeremie-de-Vos

    Joined:
    Jun 5, 2015
    Posts:
    120
    On the screenshot down below you can see what i mean.
     

    Attached Files:

  5. SarfaraazAlladin

    SarfaraazAlladin

    Joined:
    Dec 20, 2013
    Posts:
    280
    When you move the cam up, down, left, right manually do you notice this distortion? It looks like the expected result of FOV settings on your perspective camera.
     
  6. SarfaraazAlladin

    SarfaraazAlladin

    Joined:
    Dec 20, 2013
    Posts:
    280
    That's. .. pretty strange lookin
     
  7. Jeremie-de-Vos

    Jeremie-de-Vos

    Joined:
    Jun 5, 2015
    Posts:
    120
    hmm this are the settings i have on my cam.
    And yes, i notice it when i rotate the camera from up and down not from moving left to right or reversed.
     

    Attached Files:

  8. Jeremie-de-Vos

    Jeremie-de-Vos

    Joined:
    Jun 5, 2015
    Posts:
    120
    Yeah, that is what i thought to.
    I did not have this before by making a gameobject a child of the cam.
     
  9. DroidifyDevs

    DroidifyDevs

    Joined:
    Jun 24, 2015
    Posts:
    1,724
    What's the scale of the cube when it's a child object of the camera? Sometimes gameobjects will change scale if you make them children of another object.
     
  10. Jeremie-de-Vos

    Jeremie-de-Vos

    Joined:
    Jun 5, 2015
    Posts:
    120
    Sorry that i'm late whith answering.
    The scale where both cam and cube a size of 1
     
  11. SarfaraazAlladin

    SarfaraazAlladin

    Joined:
    Dec 20, 2013
    Posts:
    280
    Sorry if this sounds dumb, but is the cube a child of the player as well? Or is it just that you're looking at it in all of these screenshots?
     
  12. Jeremie-de-Vos

    Jeremie-de-Vos

    Joined:
    Jun 5, 2015
    Posts:
    120
    player->Cam->Cube