OK so i’ve been trying to get this right for a while now and its just not happening. I have a rigidbody as a player and i want to user the CheckCapsule function to detect whether the player is grounded. My understanding of the function was that if I specify 2 points, a point just below the player and a point in the center of the player, and then specify a radius, it would return true only if those points had come in contact with another object. Here’s my code.
centerOfPlayer = transform.position;
bottomOfPlayer = new Vector3(transform.position.x, transform.position.y - (ColliderComponent.radius + 0.01f), transform.position.z);
I then plug these 2 vectors into the function.
bool isGrounded = Physics.CheckCapsule(centerOfPlayer,bottomOfPlayer,ColliderComponent.radius/2);\
For some reason this always returns true. I do have GUI components over the top of my player, could it be that somehow the function thinks its colliding with them?
Any help would be much appreciated. Thanks.