HELP, THE PLAYERCONTROLLER DOES NOT WORK AS I WOULD LIKE!

Hii, so…
Ok, I’m going to get to the point. The playerController I’ve made works great, except for one huge bug… First I have to explain how it works. It is a third person game, where the camera is fixed (Like the old Resident Evils, Silent hill or the new Tormented Souls game) so when you move the Stick or the WASD the character moves, but the 3D model doesn’t rotate. I tried to make it rotate on the same GameObject but it didn’t work. So I called the 3D model and made it rotate instead of the Player, giving the Illusion that the character rotated. This worked, and didn’t give me any problems until I got much further into the project, until I put the camera somewhere else and it felt weird handling the character. Obviously (Assuming the camera was facing the Player) the Player was inverted, if I pulled the stick to the left, the Player went to the right… And I couldn’t think of anything to fix it.
I leave the lines of code right here, plus 2 videos. One showing the problem and the other is a Tormented Souls Gameplay, the move I want to achieve.

Pd: Some variables are in Spanish XD my native language.
Tormented Souls:

My video of the problem: https://youtu.be/FX4lWd-w7Ko
In the video, the screen of the Editor, if I move the stick to the left, the player moves to the left, but in the Game window it does not happen (which is what I want to happen)

//Gravedad
        if (cc.isGrounded)
        {
            move.y = 0f;
        }
        else
        {
            move.y -= gravedad * Time.deltaTime;
        }

      
        //Caminar
        move = new Vector3(I_Moverse.ReadValue<Vector2>().x, move.y, I_Moverse.ReadValue<Vector2>().y);

        //Girar en direccion del Stick
        if( move.x != 0 || move.z != 0)
        {
            Vector3 lookdir = new Vector3(move.x, 0,  move.z);
            Quaternion toRotation = Quaternion.LookRotation(lookdir);
            HANNA.rotation = Quaternion.RotateTowards(HANNA.rotation, toRotation, girarvelocidad * Time.deltaTime);
        }
      
      
        //Correr
        if(I_Correr.ReadValue<float>() > 0 && (move.x != 0f || move.z != 0f))
        {
            move = transform.TransformDirection(move) *  corrervelocidad;
            isRunning = true;     
        }
        else
        {
            move = transform.TransformDirection(move) * caminarvelocidad;
            isRunning = false;
        }
    
      
        cc.Move(move * Time.deltaTime);

HANNA is the model 3D, and is child of the Player

7940326–1015576–TPC.cs (3.28 KB)

Here’s how to get insight into what is actually happening, and reason about how you can adjust it to your needs:

You must find a way to get the information you need in order to reason about what the problem is.

What is often happening in these cases is one of the following:

  • the code you think is executing is not actually executing at all
  • the code is executing far EARLIER or LATER than you think
  • the code is executing far LESS OFTEN than you think
  • the code is executing far MORE OFTEN than you think
  • the code is executing on another GameObject than you think it is
  • you’re getting an error or warning and you haven’t noticed it in the console window

To help gain more insight into your problem, I recommend liberally sprinkling Debug.Log() statements through your code to display information in realtime.

Doing this should help you answer these types of questions:

  • is this code even running? which parts are running? how often does it run? what order does it run in?
  • what are the values of the variables involved? Are they initialized? Are the values reasonable?
  • are you meeting ALL the requirements to receive callbacks such as triggers / colliders (review the documentation)

Knowing this information will help you reason about the behavior you are seeing.

If your problem would benefit from in-scene or in-game visualization, consider using Debug.DrawRay() or Debug.DrawLine() to visualize things like raycasts or distances.

You can also put in Debug.Break() to pause the Editor when certain interesting pieces of code run, and then study the scene manually, looking for all the parts, where they are, what scripts are on them, etc.

You could also just display various important quantities in UI Text elements to watch them change as you play the game.

If you are running a mobile device you can also view the console output. Google for how on your particular mobile target.

Another useful approach is to temporarily strip out everything besides what is necessary to prove your issue. This can simplify and isolate compounding effects of other items in your scene or prefab.

Here’s an example of putting in a laser-focused Debug.Log() and how that can save you a TON of time wallowing around speculating what might be going wrong:

https://discussions.unity.com/t/839300/3

While doing the dishes I came up with a better way to do what I wanted and so far it worked!! im so happy!

Yeah sometimes I just gotta sweep the floor and change my bedsheets and it happens. I watched a YouTube vid about what would happen if the moon flew away from earth or something and 3 minutes in I eureka about how to take 2^( anything greater than 9 ). Couldn’t download the script on my phone last night so couldn’t see what the issue could have been to had been able to help.