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.