Search Unity

Literally everything is mirrored

Discussion in 'Physics' started by Ibuuyk, Mar 26, 2015.

  1. Ibuuyk

    Ibuuyk

    Joined:
    Oct 6, 2014
    Posts:
    4
    I'm trying to make a security camera that goes back and forth and tracks the player if he moves in its sight, but when I try to do a LookAt or iTween.RotateUpdate, it rotates the complete opposite way. X is reversed, Y is reversed, Z is reversed, even the position is reversed; a complete mirror. The Debug.Logs say everything is fine, the target position I'm aiming is alright. I've tried the usual transform.Rotate(0, 180, 0) trick with no results, I've tried rotating the prefab itself with no results, I've tried reversing the values with no results, I've tried Vector3.Reflect with no results, I've looked through pages and pages on Google and tried every obscure solution that theoretically makes no sense whatsoever... with no results.

    I've also noticed that I need to really exaggerate the target position for the camera's light cone to move, otherwise it just looks somewhere in the distance.

    I'm pretty sure there's a ghost in the machine at this point, anyone got a miracle cure? For NDA reasons, I can't show the code.
     
  2. Nanako

    Nanako

    Joined:
    Sep 24, 2014
    Posts:
    1,047
    it sounds like an issue with the mesh to be honest. Whatever you think forward is, is not what the mesh's forward is.

    Firstly, i'd say you should have the camera inside some parent object, that's my standard procedure. Pretty much anything containing a mesh should be a child of something else, not the world. Even if just an empty parent. And i put all the scripts, and functional components, on that parent. It allows models to be easily swapped out without affecting functionality. So anyways get it inside a parent.

    Then try setting a rotation on your camera visual object, and see how that affects the pointing. In this case you will want to run the code on its parent, not on the mesh object itself.


    If that doesn't work, then debugging by elimination, i guess. What i do is setup a debug tool for testing positions, by instantiating a small, temporary marker sphere at the target position. You can use that to easily see visually, if the target position is where it should be.

    what exactly do you mean exaggerate the target position? in terms of distance from the camera, or in terms of angular position across its field of view?
     
  3. Ibuuyk

    Ibuuyk

    Joined:
    Oct 6, 2014
    Posts:
    4
    Oh, forgot I had posted this thread. Yeah, it was an issue with the mesh, it was basically inside-out and everything was pointing inwards. It already had a parent so that didn't work, I had to reimport the mesh.