heeelp!, i need to cast a ray from transform local position to "down" in local position

Well, im struggling with this for days now, kinda depressing.

If i cast this way:

ray = new Ray(this.transform.localPosition, this.transform.position.down); // arma el rayo
Debug.DrawRay (this.transform.localPosition, this.transform.position.down * 20, Color.green);

I get a ray coming down when my vehicle is in a normal position, but when i flip it over a slope i cant get the ray to cast down the vehicle, i just get a ray “down” i world coords.

I tried with this and it works in 70% of slopes i try, but the ray is going diagonal and get strange behaviours when i have the vehicle flipped upside down, i seriously dont get this:

ray = new Ray(this.transform.localPosition,worldToLocalMatrix.MultiplyVector(this.transform.position.down)); 

Any help ASAP is really appreciated.

You want ‘transform.down’ to get a ray going in the direction that the bottom side of your vehicle is facing. And I’ll bet you want transform.position and not transform.localPosition;

 ray = new Ray(transform.position, transform.down);
 Debug.DrawRay(transform.position, transform.down);

Note that ‘this’transform.position.down’ is the same as Vector3.down, which is the world down.