The marked-up illustration below highlights the Trajectory Edit Window.
Waypoints:
The Trajectory Edit Window contains a list of ordered waypoints with various associated parameters. The listbox allows selection of one of these waypoints.
Add Node:
This button creates a new waypoint between the currently selected waypoint and the next adjacent waypoint. The midpoint is computed, and linear interpolation is also performed in time to provide its time stamp (if neccessary).
Double Resolution:
This button will add a new node between every node in the vehicle trajectory, thus doubling the resolution. Adding more resolution to the trajectory can be useful if finer-grained detail needs to be implemented.
Remove Node:
The currently selected waypoint/node is removed from the list.
This button is only available if the vehicle trajectory is non-zero and a waypoint is highlighted.
Reveal Trajectory:
This button will move the simulation camera to a top-down position above the vehicle trajectory, such that it is all in view. This can be used as a way to focus on the trajectory as a whole, or to quickly move to it if the user is currently far away.
Note: for very long trajectories, the vertical distance could be significantly large when moving the simulation camera. This is required so as to fit the full trajectory on screen.
Export:
This button will open the file dialog to allow the export of this vehicle trajectory to disk. It will be stored in the BeamNG ScriptAI format (written in .json).
Lock Node:
Clicking on this button will lock the selected waypoint, so that it will not move (in space or time) when edits are performed on the vehicle trajectory. A small ‘Lock’ icon will appear to the right of the waypoint to highlight this.
Clicking on this lock will unlock the node. Also, the ‘Lock’ button will change to an ‘Unlock’ button for the selected node, if it is locked, so the waypoint can also be unlocked by clicking on this.
Locking nodes is a useful feature if, for example, a user has put some careful detail into a small section of the trajectory, and wants to ensure that it is safe. By using locking on waypoints on either side of this region, this provides a ‘barrier’ of sorts, which ensures no future changes outside the region will affect inside the region. A suggested workflow when using the ScriptAI Editor, is to first focus in on the areas of detail, lock them off with barriers, then move on to other parts in the knowledge that the detailed areas are secure. Without locking, it is possible that edits which are made far away (in space or in time) can affect the behaviour at previously-worked-on regions.
Note that locking is also available for the camera path trajectory, and can be used in the same way.
Fix Velocity:
This button will set the velocity across the whole vehicle trajectory to the fixed constant value which is in the adjacent input box. This value can be changed as required. This is a convenience function for creating fast, basic trajectories which do not change much, or can make a good starting point for more advanced vehicle trajectories. Velocities are in kph.
Fit Spline:
This checkbox can be used to switch to a spline-representation of the vehicle trajectory. This is as opposed to the default fixed-grain polyline representation. If checked, a slider will appear which allows the user to set the granularity of the spline.
It is left to the user to decide which representation they prefer, since each has advantages and disadvantages; splines provide a much smoother curve, which can be useful to remove tight non-physical corners from a manually drawn-in trajectory, but they also have many more waypoints thus making them heavier in the computation sense. If there are many waypoints, some physical behavior may be lost due to the vehicle constantly hitting new waypoints, perhaps multiple per second.
Unchecking this box will switch back to the fixed-grain polyline representation. Note that if this is done, any detail which was edited into the spline representation is lost. In a sense, this acts like an ‘Undo’ function.
Attach Vehicle:
Clicking on this button will link this vehicle trajectory to the currently-selected vehicle (in the Vehicles Window). The button will then change to ‘Unattach’ and if pressed will de-link the two.
Upon linking a vehicle with a vehicle trajectory, the vehicle guide box is created (based on the dimensions of the attached vehicle) and this becomes active in the time transport and Scenario Guide mode of the ScriptAI Editor, so the user can move it around in space-time as required.
If the user wishes to audition different vehicles with this vehicle trajectory, the current vehicle must first be detached from the trajectory, then the new vehicle should be selected in the Vehicles Window, then attached again.
Note: At least one linkage between a vehicle and a vehicle trajectory must exist in the session in order to execute the scenario.
‘Go To’ Vehicle:
Clicking on this button will move the simulation camera to the perspective of the attached vehicle (if a vehicle is linked), and switch it to Orbit mode.
Rigid Path Translation:
This checkbox switches between rigid and non-rigid translations when editing waypoint positions. If checked, when the user moves any waypoint of the vehicle trajectory, the whole trajectory moves as if it is completely rigid (everything is translated by exactly the same amount in each dimension). If unchecked, the user can edit using the force field and manipulate individual nodes separately.
AI Assistant:
This checkbox switches on the ‘AI Asistance’ mode, which provides much greater trajectory-tracking accuracy than without. Vehicles are much more likely to satisfy the contract of the trajectory waypoints using this mode, and error will be substantially reduced to the centimeter range.
If the checkbox is unticked, the vehicle behavior is such that control is completely physical, as if a human was driving the car. Waypoints may be missed, and errors can be propagated forward in time in some cases.
If ticked, extra forces are applied as and when required to ‘force’ the vehicle on course so as to meet the commitment of the next waypoint (to be at the waypoint’s position, at the time-stamp specified in the waypoint). Note, however, that this behavior is less physical. We leave it up to the user to decide which behavior is desired, and as such offer both versions.
Note: This feature is only available with the time-based ScriptAI mode, since it is irrelevant for velocity-based ScriptAI.
Display Trajectory:
This checkbox toggles whether or not to display the trajectory lines and waypoint markers on the map.
Display Nodes:
This checkbox toggles whether or not to display order numbers for each waypoint marker on the map. This is useful when editing.
Display Velocities:
This checkbox toggles whether or not to display average velocities between each waypoint marker on the map. Again, this is useful when editing - especially when making local changes in times.
This feature is most effective when locking is used on some sections of the vehicle trajectory, since locked areas are fixed (in space and time) and thus the surrounding waypoints will change velocity to accomodate any edits made to them. This visualization gives an indication about what is happening to the velocity along the path of the trajectory, and will highlight any spikes due to editing (such as if velocities shoot up from 20kph to 90kph over a short distance, causing unwanted spikes).
Hold Velocities:
This checkbox is used when making spatial edits to the vehicle trajectory. If checked, the velocity will be maintained during a spatial edit. For example, if one node in a trajectory has an incoming and outgoing speed of 30 kph, then the node is dragged much further away, times will adjust accordingly such that the incoming and outgoing speed remains at 30 kph.
Note: This concept is a bit ambiguous when locking is used. Certain edits may not be allowed due to conflicting constraints in the trajectory.
Force Field:
This slider sets a force field range, in metres, which describes how far the effect of a waypoint position edit will travel.
Example #1: If the force field is set to 50m and we move a vehicle trajectory waypoint in space, then all nodes within 50m of that node will also move. The amount they will move by depends on how far away from the waypoint being moved.
Example #2: If the force field is set very small, eg 0.01m and we move a waypoint in space, this will be the only waypoint which will move because there are no other waypoints within the range of the force field (assuming the waypoints are all greater than 0.01m away from eachother).
Using this force field approach when editing positions can provide a much more natural trajectory edit. The nature of such editing could be described as being ’elastic’, in the sense that the stretching is reminiscent of moving points on an elastic band.
Note: Spatial force fields are also available for camera path trajectory editing, and works in a similar way.
Close Window:
The Trajectory Edit Window can be closed using the ‘Close’ button.
Note: The ScriptAI Editor supports up to three Trajectory Edit Windows at one time. These are cycled. If the user selects to open a new Trajectory Edit Window for a trajectory which is not currently being displayed, one of the existing three (if three are open) will be closed to accommodate this.
Color Selector:
The user can choose the vehicle trajectory color here. Clicking on the colored square will open a selection pallette.