Hi guys, i have this code right now, that allows my character to have his rotation be relative to the camera when he moves, but the problem, is that i want it to be for the Y and Z axis only, so that, when the camera is a little up, the character dont incline to the ground, you know?
Sorry for the bad english, i hope someone can help…
`
Transform mainCamera = Camera.main.transform;
direction =new Vector3(Input.GetAxis(“Horizontal”),0,Input.GetAxis(“Vertical”));
rotation = Quaternion.LookRotation(direction, Vector3.up);
transform.rotation = mainCamera.rotation * rotation;`
This image here shows what is happening:
[16739-what+happens.jpg|16739]
the character movement is exacltly like i want, it follows the camera rotations on y and z, but i want to lock the x rotation, so the character can stand still on the ground…