Hey everyone, first time poster. Anyways, I’m trying to get a basic script working that will determine if the object is grounded using Raycast. The code was from another post on these forums, but when I attempt to replicate it, I just get an error.
using UnityEngine;
using System.Collections;
public class cubemove : MonoBehaviour {
float distToGround;
void Start () {
distToGround = collider.bounds.extents.y;
}
...
public bool isGrounded(){
return Physics.Raycast(transform.position, -Vector3.up, distToGround + 0.1, Physics.DefaultRaycastLayers);
}
}
Building this, I get the following error: Error CS1502: The best overloaded method match for ‘UnityEngine.Physics.Raycast(UnityEngine.Vector3, UnityEngine.Vector3, float, int)’ has some invalid arguments (CS1502) (Assembly-CSharp)
I’ve checked the API repeatedly, and that constructor definitely exists for Raycast. Does anyone see where I’ve messed up?
Thanks in advance!