hi guys, i make a c# script of wallrun but i have errors i don’t understand.
i think it is a problem with the raycast
the script :
using UnityEngine;
using System.Collections;
using UnityStandardAssets.Characters.FirstPerson;
public class wallrun : MonoBehaviour {
public bool isWallR = false;
private bool isWallL = false;
private RaycastHit hitR;
private RaycastHit hitL;
private int jumpCount = 0;
private RigidbodyFirstPersonController cc;
private Rigidbody rb;
void Start() {
cc = GetComponent();
rb = GetComponent();
}
void Update () {
if (cc.Grounded)
{
jumpCount = 0;
}
if (Input.GetKeyDown(KeyCode.E) && cc.Grounded && jumpCount <= 1)
{
if(Physics.Raycast(transform.position, transform.right, 1, ray, out hitR , 1)){
if(hitR.transform.tag == “Wall”)
{
isWallR = true;
isWallL = false;
jumpCount += 1;
rb.useGravity = false;
}
}
if (Physics.Raycast(transform.position, transform.right, 1, ray, out hitL, 1))
{
if (hitL.transform.tag == “Wall”)
{
isWallL = true;
isWallR = false;
jumpCount += 1;
rb.useGravity = false;
}
}
}
}
IEnumerator afterRun () {
yield return new WaitForSeconds(0.5f);
isWallL = false;
isWallR = false;
rb.useGravity = true;
}
}
the errors :Assets/wallrun.cs(27,24): error CS1502: The best overloaded method match for `UnityEngine.Physics.Raycast(UnityEngine.Vector3, UnityEngine.Vector3, float, int, UnityEngine.QueryTriggerInteraction)’ has some invalid arguments
;
Assets/wallrun.cs(27,24): error CS1615: Argument #4' does not require
out’ modifier. Consider removing `out’ modifier.
HELP ME