Why raycast ignore the mesh colliders?
i have all LayerMask and no detect
Vector3 vector2 = 0.5f * (allWheels[0].transform.position + allWheels[1].transform.position) - new Vector3(0f, 0.5f, 1f) * .5f;
RaycastHit raycastHit;
isGrounded = Physics.Raycast(vector2, -Vector3.up, out raycastHit, .5f,wheelPhysics);
So your raycast is starting in the wrong spot and only goes for 0.5f? That’s why you’re not getting any hits.
Why are you multiplying your start vector components by 0.5f? I’m sure this is why it’s in the wrong spot. It’s possible you’re looking for localPosition
. Halving any position vector in world space will give you a point halfway between that point and (0,0,0).
Also, why is it called vector2
? Is it some second vector? That’s confusing to me due to the existence of the Vector2 class; I urge you to change the name to something else for clarity.