Hello unity community.
to cut to the chase what I am doing is I am trying to make a parkour system and what it needs to do is detect if a wall it “X” amount away from the player. I have a raycast to check if the player is grounded and that works perfectly. That is why I think I dont know what is wrong… So the problem that is happening is that I have a raycast shooting to the right of the player and this raycast does not detect gameobjects. Please any help is welcomed.
here is my parkour script
//public
public GameObject RaycastShooter;
public float ParkourIfLessThan = 1f;
public float WallRunSpeed = 9.75f;
//Distances
public float WallDistance = 1f;
//Bools
private bool CanWallRun;
private bool IsWallRunning;
//Raycast
private Vector3 RightRay = new Vector3 (1,0,0);
// Use this for initialization
void Start ()
{
}
// Update is called once per frame
void Update ()
{
//All the different Raycast hit
RaycastHit RightHit;
RaycastHit LeftHit;
if(Physics.Raycast(RaycastShooter.transform.position, RightRay.normalized, out RightHit, WallDistance))
{
float DistanceToWall = RightHit.distance;
if(DistanceToWall <= ParkourIfLessThan)
{
print("can wall run");
}
if(DistanceToWall > ParkourIfLessThan)
{
print("Can't wall run");
}
Debug.DrawLine(RaycastShooter.transform.position, RightHit.point);
}
}