Ou inversement quand je tourne le personnage la vision ne bouge pas .
voici le script du perso :
Code : Tout sélectionner
public class Player : MonoBehaviour
{
public float speed = 6f;
public float jumpspeed = 8f;
public float gravity =20f;
private Vector3 walk = Vector3.zero;
CharacterController Cac;
void Start()
{
Cac = GetComponent<CharacterController>();
}
void Update()
{
if(Cac.isGrounded){
walk = new Vector3(0, 0, Input.GetAxis("Vertical"));
walk = transform.TransformDirection(walk);
walk *= speed;
if(Input.GetButton("Jump")){
walk.y = jumpspeed;
}
}
walk.y -= gravity * Time.deltaTime;
transform.Rotate (Vector3.up *Input.GetAxis("Horizontal")*Time.deltaTime * speed * 10);
Cac.Move(walk*Time.deltaTime);
}
}
Code : Tout sélectionner
public class bougecamerasouris : MonoBehaviour
{
public float speedH = 2.0f;
public float speedV = 2.0f;
private float yaw = 0.0f;
private float pitch = 0.0f;
void Start()
{
}
void Update()
{
yaw += speedH * Input.GetAxis("Mouse X");
pitch -= speedV * Input.GetAxis("Mouse Y");
transform.eulerAngles = new Vector3(pitch, yaw, 0.0f);
}
}