Raycast collider problem, am I missing something?

Simple project:

  • a static cube with a mesh collider (replacing the default cube collider).

  • an empty gameobject with a rigidbody and a raycast collider component, placed over the static cube so when play is pressed this gameobject falls against the cube.

Pressing Play makes the raycast collider fall against the cube, but passes through it instead of colliding. It happens with mesh colliders, but using the default cube collider works fine.

Is that a bug? Because it makes the raycast collider unusable, as most sceneries are meshes.

After asking this question on the Beta group, I've been answered by the Unity team that the RayCast colliders are badly coded inside PhysX. They have decided to deprecate this collider in Unity 3 because they seem to be used very rarely.

The only workaround I can think of is using the raycast part of the WheelCollider, which work as expected but uses its own friction model instead of the material. Thus, a WheelCollider with suspensionDistance = 0 would be effectively a raycast collider of length radius. The friction could be controlled with the stiffness property of the friction curves:

var hit: WheelHit;

if (Wheel.GetGroundHit(hit))
    {
    Wheel.forwardFriction.stiffness = 0.02 * hit.collider.material.dynamicFriction;
    Wheel.sidewaysFriction.stiffness = 0.02 * hit.collider.material.dynamicFriction;
    }

Mesh colliders must be convex

http://unity3d.com/support/documentation/Components/class-MeshCollider.html