Hello, I want to cast a ray to the floor to detect what type of road my car is riding on. I tried something like this: Vector3 direction = -transform.up + new Vector3(1, 0, 0)
(because I want my direction to be a little “tilted”, not perfectly perpendicular with the road), but if my object is moving from an opposite direction the ray will be wrong; I would need something like Vector3 direction = -transform.up + new Vector3(-1, 0, 0)
.
The same problem if I want my ray to always point to the left of my object. I’m pretty sure this is something relative to the front direction of my object and a cross product, but I can’t find the exact solution.