Hello! It’s my first post. I have problem. I wrote PlayerMovementScript, and when i running the game, i’ve error: Unexpected Char: 0xAD (7,41) What i done wrong? Sorry for my English, but i’m from Poland.
PlayerMovementScript:
var cameraObject : GameObject;
var acceleration : float = 10;
function Update(){
transform.rotation = Quaternion.Euler(0, cameraObject.GetComponent(MosueLookScript).currentYRotation, 0);
rigidbody.AddRelativeForce(Input.GetAxis*("Horizontal") * acceleration, 0, Input.GetAxis("Vertical") * acceleration);
}
MouseLookScript:
@HideInInspector
var xRotation : float;
@HideInInspector
var yRotation : float;
var Sensitivity : float = 1;
var Smooth : float = 2;
@HideInInspector
var currentXRotation : float;
@HideInInspector
var currentYRotation : float;
@HideInInspector
var xRotationV : float;
@HideInInspector
var yRotationV : float;
function Update () {
xRotation -= Input.GetAxis("Mouse Y") * Sensitivity;
yRotation += Input.GetAxis("Mouse X") * Sensitivity;
currentXRotation = Mathf.SmoothDamp( currentXRotation, xRotation, xRotationV, Smooth );
currentYRotation = Mathf.SmoothDamp( currentYRotation, yRotation, yRotationV, Smooth );
xRotation = Mathf.Clamp( xRotation, -90, 90);
transform.rotation = Quaternion.Euler( currentXRotation, currentYRotation, 0);
}
MouseLookScript working. What i must change in (“Horizontal”)?