Ceci est mon script CamMouseLook et j'en ai besoin quand le joueur bouge la souris tout le long il ne tourne pas à l'envers. Je veux qu'il soit capable de regarder juste pas tellement jusqu'à ce qu'il tourne la vue à l'enversUnity Player Controller - comment faire en sorte qu'il ne bouge pas à l'envers
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CamMouseLook : MonoBehaviour {
Vector2 mouseLook;
Vector2 smoothV;
public float sensitivity = 5.0f;
public float smoothing = 2.0f;
GameObject character;
// Use this for initialization
void Start() {
character = this.transform.parent.gameObject;
}
// Update is called once per frame
void Update() {
var md = new Vector2(Input.GetAxisRaw("Mouse X"), Input.GetAxisRaw("Mouse Y"));
md = Vector2.Scale(md, new Vector2(sensitivity * smoothing, sensitivity * smoothing));
smoothV.x = Mathf.Lerp(smoothV.x, md.x, 1f/smoothing);
smoothV.y = Mathf.Lerp(smoothV.y, md.y, 1f/smoothing);
mouseLook += smoothV;
transform.localRotation = Quaternion.AngleAxis(-mouseLook.y, Vector3.right);
character.transform.localRotation = Quaternion.AngleAxis(mouseLook.x, character.transform.up);
}
}
Je t'aime. thnx fam –