Parent Player Rotate With Child Camera

Hello,

I’m having an issue with getting my parent player object not rotating with my child camera. I am using the RB FPS Controller from standard assets and I have a FixedTouch Panel to rotate my camera and that works absolutely fine so don’t want to mess with that.

I also have a simple joystick set up for my player and the issue is when I start the game everything works great. forwards, backwards, left and right and I can look around but then if I look around or spin my camera 180 and try to move, the players rotation doesn’t follow so up becomes down and right becomes left etc. I know I have nothing in my script to warrant this but I don’t know how to as the camera is a child object. I have tried setting the camera as the parent and the RB FPS as a child but then my camera doesn’t work properly and the character doesn’t move at all.

my basic movement script:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerMovement : MonoBehaviour
{

    public CharacterController controllerPlayer;
    public float speed = 10f;

    // Start is called before the first frame update
    void Start()
    {
        controllerPlayer = GetComponent<CharacterController>();
    }

    // Update is called once per frame
    void Update()
    {
        Vector3 mov = new Vector3(SimpleInput.GetAxis("Horizontal") * speed, 0, SimpleInput.GetAxis("Vertical") * speed);

        controllerPlayer.Move(mov * Time.deltaTime);
    }
}

Thanks In Advance!

What happens if you directly alter this objects transforms and not character controller?

Hello!

Sorry, I’m not 100% what you mean. As in manually adjust the transform? So if I 180 my camera in play mode and then in the inspector, 180 my character, the movement then becomes normalized again.

Thanks