Create Spline Road in Runtime

Hey all,

I’m having trouble wrapping my head around the spline concepts. I have an RTS-style set up. The user can place buildings and such and the villagers will build them automatically. All good there.

What I want to do now is allow the player to “draw” a road on the landscape that the AI will use in preference to rocks/grass/whatever. The latter part I know how to do. The problem I’m having is getting a spline to create at runtime that lets the player “draw” a road.

I know in general how I want it to work. They would click and hold where they want to start the road, then move their cursor along the map and the spline road will follow the cursor. Every X units (100, 200?) it will create a spline point. This is easy enough. The part I can’t get to work is getting that spline point tangent aligned to the terrain underneath so the road will follow up and down hills and work correctly around turns.

Can anyone provide any guidance?