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 ¶
NewSystem returns the system for w. With game.Engine, add it to a stage with game.Wrap.