Skip to content

atl/sm/pathfinder

import "atl/sm/pathfinder"

Navigation-mesh pathfinding (sm.pathfinder).

func ConstrainToNavMesh(world sm.World, point sm.Vec3, a *Abilities) sm.Vec3

[server] The nearest point to point on the navigation mesh.

func RandomPoint(world sm.World, point sm.Vec3, radius float64, a *Abilities) sm.Vec3

[server] A random reachable point within radius of point.

func Path(character sm.Character, destination sm.Vec3, groundPosition *bool, a *Abilities, c *Costs) atl.Value

[server] A path for a character to destination, as the game's path table.

func WorldPath(world sm.World, start, destination sm.Vec3, a *Abilities, c *Costs) []sm.PathNode

[server] The nodes of a path between two points in a world.

func SortedNodes(position sm.Vec3, minDistance, maxDistance float64) []sm.PathNode

[server] Path nodes around position between the two distances, nearest first.

type Abilities struct {
CanWalk *bool
CanSwim *bool
}

Movement abilities; unset fields keep the game's defaults.

type Costs struct {
Ground, Water, Chemicals, Oil, Lava *float64
}

Per-terrain movement costs; unset fields keep the game's defaults.

type Traversal struct {
Clear bool
Fraction float64
}

Result of TraversableRaycast: whether the way is clear, and how far it got (0..1).

func TraversableRaycast(world sm.World, start, destination sm.Vec3, a *Abilities) Traversal

[server] Checks whether a unit can move in a straight line from start to destination.