animbody

package
v0.0.0-...-94fff03 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2026 License: MIT Imports: 6 Imported by: 0 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 animbody keeps animated colliders in step with their animation: an entity whose collision.Collider has the shape collision.ShapeAnimBody takes its Offset and Size from the Body of the clip its gfx.Animator plays.

It is opt-in, like collision itself: a game that uses anim-body colliders adds System to its schedule, and neither anim nor game imports collision.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type System

type System struct {
	// contains filtered or unexported fields
}

System writes, for every entity with a gfx.Animator and a collision.Collider of kind ShapeAnimBody, the collider's Offset and Size from the current clip's Body (the definition's fixed body, never the per-frame boxes, and unflipped), once the clip is loaded and only when they differ.

It needs the *asset.Server resource. Add it to the simulate stage before the collision system, so the colliders are current when collisions are found. Run does not allocate.

func NewSystem

func NewSystem(w *ecs.World) *System

NewSystem returns the system for w. With game.Engine, add it to a stage with game.Wrap.

func (*System) Init

func (s *System) Init(ctx *system.Context)

Init implements system.Initializer. It caches the Clip store, so register the loaders (anim.RegisterLoaders) and set the *asset.Server resource first.

func (*System) Run

func (s *System) Run(ctx *system.Context)

Run implements system.Runner.

Jump to

Keyboard shortcuts

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