Cauldron3D.Hull (Cauldron3D v0.2.2)

Copy Markdown View Source

A collision hull: a BSP tree of planes whose leaves are only contents, swept by a point.

A box moves through a world by tracing a point through a hull whose walls are pushed out by the box's size; a world keeps one hull per box size it allows. A thing's own box is a hull too (box/2).

trace = Cauldron3D.Hull.trace(hull, from, to)
trace.fraction

clipnodes is a tuple of {plane, front, back}, the plane an index into planes ({normal, distance}); a child at or above zero is another clipnode, below zero a contents value (see Cauldron3D.Bsp). head is the clipnode to start from, and mins and maxs the box the hull was pushed out by.

Summary

Functions

The hull starting at clipnode head instead.

A hull that is solid inside the box mins..maxs and empty outside, for tracing past a thing.

The contents at point.

A point moved in a straight line from from to to through the hull, stopped by the first solid it meets.

Types

t()

@type t() :: %Cauldron3D.Hull{
  clipnodes: tuple(),
  head: integer(),
  maxs: Cauldron3D.Vec.t(),
  mins: Cauldron3D.Vec.t(),
  planes: tuple()
}

Functions

at(hull, head)

@spec at(t(), integer()) :: t()

The hull starting at clipnode head instead.

box(arg1, arg2)

@spec box(Cauldron3D.Vec.t(), Cauldron3D.Vec.t()) :: t()

A hull that is solid inside the box mins..maxs and empty outside, for tracing past a thing.

contents(hull, point)

@spec contents(t(), Cauldron3D.Vec.t()) :: integer()

The contents at point.

trace(hull, from, to)

A point moved in a straight line from from to to through the hull, stopped by the first solid it meets.