I know you can cast a ray from the rigidbody, but if i am using a ragdoll with a lot of rigidbodies and colliders, how can I choose only one part of the armature, lets say the hips(I mean the hips green collider), to check collision with the ground.
But only raycast from this bone and disable all the rest of the raycasts?
Like this:
I have this script that raycasts to check if the character is grounded
void IsGrounded()
{
RaycastHit hitInfo;
if (Physics.Raycast(transform.position + Vector3.up * 0.8f, Vector3.down * 0.5f, out hitInfo, Mathf.Infinity))
{
if (hitInfo.distance > 0.1f) // Change .1f to what you need
Debug.DrawRay(transform.position + Vector3.up * 5f, Vector3.down * 5f, Color.green);
isgrounded = false;
if (hitInfo.distance < 0.1f)
isgrounded = true;
}
}