run Dynamics3D
suspend fun <A : AgentLike> KSLProcessBuilder.runDynamics3D(agent: A, dynamics: Dynamics3D<A>, dt: Double = 0.05, until: () -> Boolean = { false })(source)
Run agent under dynamics until until returns true. Each iteration: compute the 3D Euler step, store the new velocity, move the agent to the candidate position as-is, delay dt.
Convenience for the "no boundary handling" case. For models with no-fly zones, altitude clamps, or torus wrap on positions, write your own loop around Dynamics3D.step so you can validate / transform the candidate before applying.
val script = process(isDefaultProcess = true) {
runDynamics3D(this@Drone, dynamics, dt = 0.05) {
field.arrivedAt(space.positionOf(this@Drone)!!)
}
}Content copied to clipboard
Throws
if dt is non-positive