I have the following simple raycast from a capsule on a cube:
bool hit = Physics.Raycast (transform.position, Vector3.down, jumpSettings.groundJumpDistanceCheck, jumpSettings.layerMask); print(hit);
layerMask is 8 (terrain), I have set my layer on my cube and my
groundJumpDistanceCheck is 2. Then my
hit is false.
groundJumpDistanceCheck is set to Infinity. Then my
hit is still false.
However when I remove the distance parameter:
bool hit = Physics.Raycast (transform.position, Vector3.down, /* jumpSettings.groundJumpDistanceCheck, */ jumpSettings.layerMask); print(hit);
hit returns true. This is odd for me, as far as I know when you exclude the distance parameter it's supposed to be Infinity by default. But when I explicitly give Infinity as the distance, it returns false.
I have also used the following code in an attempt to debug my issue, using the desired distance
Debug.DrawRay(transform.position, Vector3.down * jumpSettings.groundJumpDistanceCheck, Color.red, 60f);
As you can see, the ray does intercept the cube.
I need the reycast to return true with a distance of