Help me (SHORT SCRIPT) :) THANK YOU! :)

So here is the script, i covered my problem in red :slight_smile: I get an error who says: unknow identifier: walkAccelAirRacio

THANK YOU ALL WHO HELPED :slight_smile:

var walkAcceleration : float = 5;
var walkAcceleRacio : float = 0.1;
var walkDecceleration : float = 5;
@HideInInspector
var walkDeaccelerationVolx : float;
@HideInInspector
var walkDeaccelerationVolz : float;

var cameraObject : GameObject;
var maxWalkSpeed : float = 20;
@HideInInspector
var horizontalMovement : Vector2;

var jumpVelocity : float = 20;
@HideInInspector
var grounded : boolean = false;
var maxSlope : float = 60;

function Update ()
{
horizontalMovement = Vector2(rigidbody.velocity.x, rigidbody.velocity.z);
if (horizontalMovement.magnitude > maxWalkSpeed)
{
horizontalMovement = horizontalMovement.normalized;
horizontalMovement *= maxWalkSpeed;
}
rigidbody.velocity.x = horizontalMovement.x;
rigidbody.velocity.z = horizontalMovement.y;

if (Input.GetAxis(“Horizontal”) == 0 Input.GetAxis(“Vertical”) == 0 grounded){
rigidbody.velocity.x = Mathf.SmoothDamp(rigidbody.velocity.x, 0, walkDeaccelerationVolx, walkDecceleration);
rigidbody.velocity.z = Mathf.SmoothDamp(rigidbody.velocity.z, 0, walkDeaccelerationVolz, walkDecceleration);

}

transform.rotation = Quaternion.Euler(0, cameraObject.GetComponent(MouseLookScript).currentYRotation, 0);
if (grounded)
rigidbody.AddRelativeForce(Input.GetAxis(“Horizontal”) * walkAcceleration * Time.deltaTime, 0, Input.GetAxis(“Vertical”) * walkAcceleration * Time.deltaTime);
else
rigidbody.AddRelativeForce(Input.GetAxis(“Horizontal”) * walkAcceleration * walkAccelAirRacio * Time.deltaTime, 0, Input.GetAxis(“Vertical”) * walkAcceleration * walkAccelAirRacio * Time.deltaTime);

if (Input.GetButtonDown(“Jump”) grounded)
rigidbody.AddForce(0,jumpVelocity,0);
}

function OnCollisionStay (collision : Collision)
{
for(var contact : ContactPoint in collision.contacts)
{
if (Vector3.Angle(contact.normal, Vector3.up) < maxSlope)
grounded = true;
}
}
function OnCollisionExit()
{
grounded = false;
}

You put “walkAcceleRacio” in the declaration (Accel EEEEE Racio), it must be “walkAccelRacio”

It says unknow identifier: “walkAccelRacio” now :frowning: whats wrong? :stuck_out_tongue:

Hi, you have to declare walkAccelAirRacio.