Track Building
Adding in your track
Section titled Adding in your trackClick on the ’+’ button to create a new scene, and name it track_1.tscn
.
-
Add a Node3D.
-
Add a Path3D to Node3D.
-
In your main scene with the ground, drag this saved track scene into the Ground (the top) node. You might notice that the path is below (or in line with) the ground. You will need to decrease the y-position of the ground.
-
Back in your track scene, you’ll notice that Path3D has extra options in the navigation bar. Hover over each of them to get an understanding of what their functions are.
- Click on the green Add point button.
- Click on the Y Axis (the top right coloured axes) so that each of these points will be at the same height.
- Add your points.
- To finish, click the blue triangle Close curve button.
-
Making the path curved
Section titled Making the path curved- Click the Select control points.
- Hold shift and click each point to drag the control handles around.
- It should something like this inside the world scene:
-
Making some hills
Section titled Making some hillsMove your path points up using the green up arrow.
-
Making the path visible
Section titled Making the path visible- Add CSGPolygon to Path3D.
- Set the Mode to Path.
- Assign the Path Node to the Path3D.
-
Changing the shape of the path
Section titled Changing the shape of the path- Click the Polygons’ PackedVector2Array and you will see size 4 (we need 4 corners to make a rectangular path).
These are the numbers I have entered in:
Explanation
- If you change corners 0 and 1 to have their x = -5, then corners 2 and 3 to have their x = 5, you will see the path widen.
- If you leave corners 0 and 3 to have their y = 0, then change corners 1 and 2 to have their y = 0.1, the path will be thinner.
- Now, move the car onto the track to see if the sizing of the path is good. If the sizing is bad, change the x and y to be wider or thicker, respectively.
-
Tilting the path (if your end points haven’t joined together properly)
Section titled Tilting the path (if your end points haven’t joined together properly)- On Path3D, select the yellow circle button (which will then turn green) and then use the dots on each point to change each points’ tilt.
- If you see any points in the path which doesn’t look ‘smooth’ enough, change the tilt.
-
In the CSGShape3D section, tick the Use Collision checkbox so the car can drive on the path.
-
Creating a road-like texture
Section titled Creating a road-like texture- Inside the CSGPolygon3D, make a new StandardMaterial3D under Material.
- Download this road picture from OpenGameArt. Rotate the picture.
- Adjust the Scale under UV1 to fit your path.
It should look something like this (some path points have been deleted to make this first track easy).
-
Test it out and change the tilting, size, and height of the track if it’s too hard to complete.