I have script for walking and jumping
This is link for that http://pastebin.com/raw.php?i=1x3r0RBn
I have 4 errors
- Assets/My assets/Skript/PlayerMovementScript.js(68,1): BCE0044: expecting }, found ‘’.
- Assets/My assets/Skript/PlayerMovementScript.js(61,11): BCE0044: expecting (, found ‘OnCollisionExit’.
3.Assets/My assets/Skript/PlayerMovementScript.js(55,2): BCE0044: expecting ), found ‘grounded’.
4.Assets/My assets/Skript/PlayerMovementScript.js(50,26): BCE0043: Unexpected token: collision.
Though the compiler is only listing 4 errors, you have a lot more than 4 errors. I did a quick pass to get your script to compile. You’ll have to figure out any logic problems. For future posts, please past your code into your question, select your code and use the 101/010 button to format. Also proper indentation makes the code easier to read, and in this case, would have made your first error jump out at you.
var acceleration : float = 10;
var deacceleration : float = 10;
var deaccelerationX : float;
var deaccelerationZ : float;
var jumpVelocity : float = 400;
var grounded : boolean = false;
var maxslope : float = 60;
var cameraObject : GameObject;
var maxSpeed : float = 25;
var movement : Vector2;
movement = Vector2( rigidbody.velocity.x, rigidbody.velocity.z);
if ( movement.magnitude > maxSpeed)
movement = movement.normalized;
movement *= maxSpeed;
rigidbody.velocity.x = movement.x;
rigidbody.velocity.z = movement.y;
if (Input.GetAxis("Horizontal") == 0 && Input.GetAxis("Vertical") == 0 && grounded)
rigidbody.velocity.x = Mathf.SmoothDamp(rigidbody.velocity.x, 0, deaccelerationX, deacceleration);
rigidbody.velocity.z = Mathf.SmoothDamp(rigidbody.velocity.z, 0, deaccelerationZ, deacceleration);
transform.rotation = Quaternion.Euler(0, cameraObject.GetComponent(MouseLook).currentYRotation, 0);
rigidbody.AddRelativeForce(Input.GetAxis("Horizontal") * acceleration * Time.deltaTime, 0, Input.GetAxis("Vertical") * acceleration * Time.deltaTime);
if(Input.GetButtonDown("Jump") && grounded)
function OnCollisionStay(collision : Collision)
for (var contact : ContactPoint in collision.contacts)
if(Vector3.Angle(contact.normal, Vector3.up) < maxslope)
grounded = true;
grounded = false;