event

package
v0.14.2 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: LGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContactBeginEvent

type ContactBeginEvent struct {
	ContactEventPayload
}

ContactBeginEvent is emitted after the physics step when two non-sensor fixtures begin touching. Normal and Point are populated when the collision manifold has at least one point (see NormalValid / PointValid).

func (ContactBeginEvent) Name

func (ContactBeginEvent) Name() string

type ContactEndEvent

type ContactEndEvent struct {
	ContactEventPayload
}

ContactEndEvent is emitted after the physics step when two non-sensor fixtures stop touching. Manifold data is usually unavailable for EndContact; NormalValid/PointValid are typically false.

func (ContactEndEvent) Name

func (ContactEndEvent) Name() string

type ContactEventEmitter

type ContactEventEmitter interface {
	EmitContactBegin(ContactBeginEvent)
	EmitContactEnd(ContactEndEvent)
	EmitTriggerBegin(TriggerBeginEvent)
	EmitTriggerEnd(TriggerEndEvent)
}

ContactEventEmitter is the per-step sink for flushed physics contact/trigger events. The physics step driver assigns an implementation (PhysicsRuntime.Emitter) before World.Step and calls FlushBufferedContacts after the step.

type ContactEventPayload

type ContactEventPayload struct {
	FilterA     FixtureFilterBits `json:"filter_a"`
	FilterB     FixtureFilterBits `json:"filter_b"`
	EntityA     cardinal.EntityID `json:"entity_a"`
	EntityB     cardinal.EntityID `json:"entity_b"`
	ShapeIndexA int               `json:"shape_index_a"`
	ShapeIndexB int               `json:"shape_index_b"`
	Normal      component.Vec2    `json:"normal"`
	NormalValid bool              `json:"normal_valid"`
	Point       component.Vec2    `json:"point"`
	PointValid  bool              `json:"point_valid"`
}

ContactEventPayload is shared data for all flushed contact/trigger events. Entity/fixture ordering and how filter/manifold fields are filled can differ between a normal step (live Box2D callbacks) and recovery after a world rebuild; see internal/contact_flush.go.

type FixtureFilterBits

type FixtureFilterBits struct {
	CategoryBits uint64 `json:"category_bits"`
	MaskBits     uint64 `json:"mask_bits"`
	GroupIndex   int32  `json:"group_index"`
}

FixtureFilterBits is the Box2D collision filter for one fixture at contact time. It matches ECS ColliderShape CategoryBits/MaskBits and the fixture’s GroupIndex (non-zero group rules override category/mask in Box2D).

type TriggerBeginEvent

type TriggerBeginEvent struct {
	ContactEventPayload
}

TriggerBeginEvent is emitted after the physics step when an overlap involving at least one sensor begins.

func (TriggerBeginEvent) Name

func (TriggerBeginEvent) Name() string

type TriggerEndEvent

type TriggerEndEvent struct {
	ContactEventPayload
}

TriggerEndEvent is emitted after the physics step when an overlap involving at least one sensor ends.

func (TriggerEndEvent) Name

func (TriggerEndEvent) Name() string

Jump to

Keyboard shortcuts

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