![]() |
RigsofRods
2023.09
Soft-body Physics Simulation
|
This introduces scripting API for full procedural road management and also bundled script "road_editor.as" which allows interactive road editing!
You can also script custom meshes using addQuad()
and addCollisionQuad()
.
The central object is TerrainClass, obtainable by game.getTerrain()
. Historically we already have a lot of terrain-related functions in the GameScriptClass
(global object game
), see https://developer.rigsofrods.org/dc/d63/class_script2_game_1_1_game_script_class.html, but under the hood those are serviced by RoR::Terrain
anyway. Please mind the additional getHandle()
function in the code snippets - that's a necessary evil to manage AngelScript reference counting simply and safely using https://github.com/only-a-ptr/RefCountingObject-AngelScript. Without it, adding new script feats is either laborous and bug-prone, or unsafe.
Road specific objects: ProceduralPointClass, ProceduralRoadClass, ProceduralObjectClass, ProceduralManagerClass.
To start the editor script, open console and say "loadscript road_editor.as".
To export road points as AI waypoints, use 2 sliders to specify a range, and press an export button:
There's also an import of AI waypoints as procedural road points, with the same controls:
Hotkeys: