Raycast Stabilisation.

Hi all, I have a couple of rays that are fired form the front of my Veh, the idea is to eventually have a guidance system for AI using them. for now though the rays hitting the ground under braking because of the spongy suspension. is there a way of working out the angle of the veh and applying the the opposite to the ray so it stays at the same height of the ground throughout its length?

many thanks

I’m not a Math expert, but maybe look at Mathf.DeltaAngle. The Subtract that value from your global (horizontal) angle?

I would raycast down from the center of the car to hit the track, and then get the normal of the hitpoint on the track, then use that as the angle to send the ray from the front of the vehicle.

Then you’d always be raycasting parallel to the track.

brilliant, thank you for the nudge,