travelTo3D

suspend fun <A : AgentLike> KSLProcessBuilder.travelTo3D(agent: A, space: ContinuousVolume<in A>, destination: Point3D, velocity: Double, stepSize: Double = Travel.Defaults.stepSize): TravelResult(source)

Move agent from its current 3D position in space to destination at constant velocity. The 3D analog of travelTo.

The traversal takes distance / velocity simulated time units; the projection is updated to interpolated intermediate positions every stepSize coordinate-units of travel so concurrent spatial queries (space.within(...), space.neighborsOf(...)) reflect the moving agent's current 3D position at step granularity.

Pattern (discrete-step continuous motion in 3D):

inner class Drone : Agent("d") {
val script: KSLProcess = process(isDefaultProcess = true) {
travelTo3D(this@Drone, airspace,
destination = Point3D(50.0, 50.0, 30.0),
velocity = 5.0)
}
}

Reuses Travel.Defaults.stepSize for the default — the parameter is in coordinate units of travel regardless of dimensionality, so 2D and 3D models share the same notion of spatial step granularity.

Reuses TravelResult — durations, distances, and start/arrival times are scalar regardless of how many dimensions the motion spans.

Edge cases (same as the 2D version):

  • If current == destination the function returns immediately with distance == 0.0.

  • If totalDistance <= stepSize, a single delay-and-snap is used.

  • The final position is set exactly to destination (no floating-point drift).

Limitations (same as the 2D version): uninterruptible; no collision detection; constant velocity per call. See §12.6 of the agent-based-modeling design doc for the deferred interruptible-travel work.

Return

a TravelResult describing the completed motion.

Parameters

agent

the moving agent; must be a member of space's context and already placed somewhere.

space

the 3D projection in which the motion occurs.

destination

target 3D coordinates.

velocity

speed in coordinate-units-per-simulated-time; must be positive.

stepSize

interpolation interval in coordinate units of travel; must be positive.