Hi, I have tried to remove this problem multiple times without success. Error message:
Assets/Scripts/PlayerController.cs(45,46): error CS1525: Unexpected symbol `movement’
Here’s the script:
using UnityEngine;
using System.Collections;
public class PlayerController : MonoBehaviour {
public float speed = 6.0F;
public float jumpSpeed = 1000.0F;
public float gravity = 1.0F;
public float fallSpeed = 2.0F;
public float moveforward;
public float slowdown;
private bool jumping;
private float v;
private float h;
private Rigidbody rb;
private Transform transform;
private Vector3 movement;
void Start ()
{
rb = GetComponent<Rigidbody> ();
}
void Update ()
{
h = Input.GetAxis ("Horizontal");
jumping = Input.GetButtonDown ("Jump");
h *= speed;
movement = Vector3 (h, 0.0f, moveforward);
rb.AddForce (movement);
}
void LateUpdate ()
{
rb = GetComponent<Rigidbody> ();
Vector3 subtract = new Vector3 (0.0f, 0.0f, slowdown);
rb.AddForce (subtract);
}
void OnCollisionEnter (Collision other, Vector3 movement)
{
if (other.gameObject.CompareTag ("Ground"))
{
Jump (Vector3 movement);
}
}
void Jump(Vector3 movement)
{
if (jumping == true)
{
movement.y = jumpSpeed;
movement.y /= gravity;
}
}
}
Help is, of course, appreciated! Thanks!