cover3d

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2026 License: Apache-2.0 Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package cover3d generates ai.CoverPoint values from the colliders of a physics3d world, projecting the vertical faces of 3D obstacles onto the XZ ground plane.

It lives apart from pkg/ai so that ai does not depend on the 3D physics engine and physics3d does not depend on ai.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromBodies

func FromBodies(bodies []*physics3d.Body, opts Options) []ai.CoverPoint

FromBodies generates deterministic XZ-plane cover points from the given 3D bodies: axis-aligned or oriented boxes, spheres, vertical capsules, and cylinders standing on an end (their axis within about 25 degrees of vertical). Convex hulls and cylinders lying on their side generate no cover.

func FromWorld

func FromWorld(w *physics3d.World, opts Options) []ai.CoverPoint

FromWorld generates deterministic XZ-plane cover points along the vertical faces of matching colliders in w, discarding points that overlap any other matching collider.

Types

type Options

type Options struct {
	// Spacing is the horizontal distance between cover samples along each collider face (defaults to 1.0 when <= 0).
	Spacing float32
	// Standoff offsets each cover point outward from the collider face into open space (defaults to 0.5 when <= 0).
	Standoff float32
	// EdgeInset is the margin from face corners (defaults to Spacing * 0.5 when <= 0).
	EdgeInset float32
	// MinEdgeLength skips horizontal faces shorter than this length (<= 0 allows any positive face).
	MinEdgeLength float32
	// HalfCoverMinHeight is the minimum obstacle vertical height for ai.CoverHalf (defaults to 0.7 when <= 0). Shorter obstacles (such as floor slabs) do not generate cover.
	HalfCoverMinHeight float32
	// FullCoverMinHeight is the minimum obstacle vertical height for ai.CoverFull (defaults to 1.6 when <= 0).
	FullCoverMinHeight float32
	// LayerMask filters bodies considered as cover obstacles (0 defaults to physics3d.LayerAll).
	LayerMask physics3d.LayerMask
	// IncludeDynamic includes non-static bodies when true; by default only static level geometry generates cover.
	IncludeDynamic bool
	// StartID is the first ai.CoverPoint.ID assigned (defaults to 1 when 0).
	StartID uint64
}

Options configures 3D collider-edge cover point generation projected onto the XZ ground plane.

Generated ai.CoverPoint values store (X, Z) in Pos, the obstacle's floor Y in Elevation, and the horizontal XZ unit direction into the obstacle in Facing.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL