Problem turning character in Unity 2D

1

I have the following problem when I turn my character in unity with the following function

    if (direccion < 0 && izq)
    {
        transform.rotation = Quaternion.AngleAxis(180, Vector3.up);
        izq = false;
        der = true;

    }
    else if (direccion > 0 && der)
    {

        transform.rotation = Quaternion.AngleAxis(0, Vector3.up);
        izq = true;
         der = false;

    }        

But now it turns out that when it turns to the left the character appears cut in half but in the "Game" window because in the "Scene" window it appears normal and the strange thing is that when it returns to its initial position it appears complete , Now if my question is.

Because I hate unity U:: jaajjaj Really I can not find more explanation to what happens because if I manually modify the values of the rotation when I play the game there if it appears complete: "C. So please, if someone happens, I'm really asking you to explain it. I'm about to reinstate unity because I do not find it more meaningful that it's not working well. Thank you very much in advance.

PS: I can not use the SpriteRender flipX function for aesthetic reasons (the mouth stays static where it is because it is a separate object).

    
asked by Guayavas 07.12.2018 в 21:15
source

1 answer

0

Check the order and positions of the objects with respect to the camera, when rotating objects in and it is likely that the depth will be affected if the camera is not far enough from the objects, good practice is to put camera in z- 20, scenarios in z0 and elements in levels -1: -19

    
answered by 12.12.2018 / 17:12
source