I have a vehicle that needs to move on a randomly generated terrain and handle slopes. I'm not using wheels, but instead moving the vehicle with velocity. The ideal case would be if I can make the vehicle rotate according to the terrain edges and move smoothly as shown here:

Diagram of a green square sliding down a black terrain, rotating to match the ground

How can I accomplish this? Launching raycast from the bottom left angle and calculating the distance from the ground, then rotating according to that?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.