- Home /
how to let an object drive on a road?
following situation: i have a road mesh generated by script. i already tried gravity which works so far but my problem is If the object drives up on a hill, the speed decreases and if it drives down the hill it increases. but i want it to have a constant speed that i can manipulate. i want it to exactly follow the road. i hope you understand what i mean.
Answer by Cherno · Jun 04, 2015 at 12:11 PM
You can disable gravity and set the object's transform.rotation to be perpendicular to the ground surface normal under it. Then, you can just set the velocity to whatever you want.
okayyyyyy... lets say i don't have any normals. the following is the case i used i library that creates a plane mesh with x x-segments and y z-segments. than i manipulated the y-values für every segment to create a road. i'm not sure if there are normals created by the plugin i used. i just now I didn't create them.