-
Notifications
You must be signed in to change notification settings - Fork 3
Polyline item
Roads and various other items in the game are procedurally generated by drawing a spline through the nodes of the items and creating geometry along that path.
I've yet to figure out which spline function is actually used in the game. In TruckLib, I'm using a cardinal spline with a tension of 1.2, which is close enough in most cases, but it's not entirely accurate.
This is important because, to my great annoyance, the rotation of a node and the length of an item are cached in the map files. If you don't get them right, the game will initially create the items with your inaccurate values, and to fix them, you need to open the properties dialog of each node and click Cancel, after which it will recalculate the node and its attached items and reset them to the actual values.
To the best of my knowledge, the length is simply an approximation of the length of the spline.
The rotation value of the two nodes of a polyline item are the tangents of the spline. This rotation value can either be set manually using the Free Rotation option, or the game can calculate it automatically:
For a node with only one "neighbor" in either direction, the rotation of both nodes is simply the direction of that segment.
For a node p1 with a "neighbor" in both directions: Take the yaw of (p1-p0), add the yaw of (p2-p1), divide by 2. Or something like that. I haven't actually checked what do to with the other two angles yet.
-
.base/.aux/.snd
- Animated Model
- Bezier Patch
- Buildings
- Bus Stop
- Camera Path
- Camera Point
- City
- Company
- Compound
- Curve
- Cut Plane
- Cutscene
- Environment Area
- Far Model
- Ferry
- Fuel Pump
- Garage
- Gate
- Hinge
- Hookup
- Map Area
- Map Overlay
- Model
- Mover
- Parking
- Prefab
- Road
- Service
- Sign
- Sound
- Terrain
- Traffic Area
- Trajectory
- Trigger
- Visibility Area
- Walker