I have this error message in my console and i don’t know how to solve it
(I’m very new to this so please help.)
#pragma strict
var playerAcceleration : float = 500;
var cameraObject : GameObject;
var maxSpeed : float = 20;
var horizontalMovement : Vector2;
var deacelerationX : float;
var deacelerationZ : float;
var jumpSpeed : float = 20;
var maxSlope : float = 60;
var grounded : boolean = false;
function Update ()
{
horizontalMovement = Vector2(rigidbody.velocity.x,rigidbody.velocity.z);
if (horizontalMovement.magnitude > maxSpeed)
{
horizontalMovement = horizontalMovement.normalized;
horizontalMovement *= maxSpeed;
}
rigidbody.velocity.x = horizontalMovement.x;
rigidbody.velocity.z = horizontalMovement.y;
if (Input.GetAxis("Horizontal") == 0 && Input.GetAxis("Vertical") == 0
{
rigidbody.velocity.x = Mathf.SmoothDamp(rigidbody.velocity.x,0,deacelerationX, deaceleration);
rigidbody.velocity.z = Mathf.SmoothDamp(rigidbody.velocity.z,0,deacelerationZ, deaceleration);
}
transform.rotation = Quaternion.Euler(0, cameraObject.GetComponent(MouseLook).CurrentYRotation,0);
rigidbody().AddRelativeForce(Input.GetAxis("Horizontal")*playerAcceleration * Time.deltaTime,0,Input.GetAxis("Vertical")*playerAcceleration * Time.deltaTime);
if (Input.GetButtonDown("Jump") && grounded)
{
rigidbody.Addforce(0,jumpspeed,0);
}