# `Cauldron3D.Move`
[🔗](https://github.com/jaman/cauldron/blob/v0.2.2/cauldron_3d/lib/cauldron_3d/move.ex#L1)

Moving a box through a world: sliding along what it hits, and stepping up ledges.

Every function takes `trace`, `fn from, to -> Cauldron3D.Hull.Trace.t() end`, which
says how far the box gets along a straight line; the caller decides what it collides
with.

    Cauldron3D.Move.slide(trace, origin, velocity, 1 / 72)
    #=> %{origin: ..., velocity: ..., blocked: [:floor], hits: [trace, ...]}

# `result`

```elixir
@type result() :: %{
  origin: Cauldron3D.Vec.t(),
  velocity: Cauldron3D.Vec.t(),
  blocked: [:floor | :wall],
  hits: [Cauldron3D.Hull.Trace.t()]
}
```

# `tracer`

```elixir
@type tracer() :: (Cauldron3D.Vec.t(), Cauldron3D.Vec.t() -&gt;
               Cauldron3D.Hull.Trace.t())
```

# `clip`

```elixir
@spec clip(Cauldron3D.Vec.t(), Cauldron3D.Vec.t(), number()) :: Cauldron3D.Vec.t()
```

`velocity` with the part going into a plane of `normal` taken out, `overbounce` times
over (1.0 slides along it, more than 1.0 bounces off). Components smaller than 0.1 come
out as zero.

# `slide`

```elixir
@spec slide(tracer(), Cauldron3D.Vec.t(), Cauldron3D.Vec.t(), number(), keyword()) ::
  result()
```

Move for `seconds` at `velocity`, sliding along up to four surfaces. A hit plane whose
normal points up more than `:floor` (default 0.7) blocks as a floor; an upright one as
a wall. The velocity is stopped when it would turn back on itself or is pinned in a
corner.

# `step`

```elixir
@spec step(
  tracer(),
  Cauldron3D.Vec.t(),
  Cauldron3D.Vec.t(),
  number(),
  number(),
  keyword()
) :: result()
```

As `slide/5`, but a box stopped by a wall tries again from up to `step` higher and
settles back down, keeping whichever went further along the ground. Takes `slide/5`'s
options.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
