Documentation ¶
Overview ¶
Package phy implements a minimal physics simulation necessary for realistic bot behavior.
Index ¶
- type AABB
- func (bb AABB) Contract(x, y, z float64) AABB
- func (bb AABB) Expand(x, y, z float64) AABB
- func (bb AABB) Extend(dx, dy, dz float64) AABB
- func (bb AABB) Intersects(o AABB) bool
- func (bb AABB) Offset(x, y, z float64) AABB
- func (bb AABB) XOffset(o AABB, xOffset float64) float64
- func (bb AABB) YOffset(o AABB, yOffset float64) float64
- func (bb AABB) ZOffset(o AABB, zOffset float64) float64
- type MinMax
- type State
- type Surrounds
- type World
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AABB ¶
type AABB struct {
X, Y, Z MinMax
Block world.BlockStatus
}
AABB implements Axis Aligned Bounding Box operations.
func (AABB) Contract ¶
Contract reduces the difference between the min/max bounds (for positive values) for each dimension.
func (AABB) Expand ¶
Expand increases both the minimum and maximum bounds by the provided amount (for positive values) for each dimension.
func (AABB) Extend ¶
Extend adjusts the minimum (for negative values) or maximum bounds (for positive values) by the provided scalar for each dimension.
func (AABB) Intersects ¶
type MinMax ¶
type MinMax struct {
Min, Max float64
}
func (MinMax) Contract ¶
Contract reduces both the minimum and maximum bound by the provided amount, such that the difference between the bounds decreases for positive values.
func (MinMax) Expand ¶
Expand changes the minimum and maximum bounds by the provided amount, such that the difference between the bounds increases for positive values.
type State ¶
type State struct { // player state. Pos path.Point Vel path.Point Yaw, Pitch float64 Run bool // contains filtered or unexported fields }
State tracks physics state.
func (*State) AtLookTarget ¶
AtLookTarget returns true if the player look position is actually at the given pitch and yaw.
func (*State) ServerPositionUpdate ¶
type Surrounds ¶
type Surrounds []AABB
Surrounds represents the blocks surrounding the player (Y, Z, X).
type World ¶
type World interface {
GetBlockStatus(x, y, z int) world.BlockStatus
}
World represents a provider of information about the surrounding world.