event

package
v0.16.9 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: LGPL-3.0 Imports: 6 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) AppendWire added in v0.16.9

func (c ContactBeginEvent) AppendWire(b []byte) []byte

func (ContactBeginEvent) FromProto added in v0.15.0

func (ContactBeginEvent) MarshalWire added in v0.15.0

func (c ContactBeginEvent) MarshalWire() []byte

func (ContactBeginEvent) Name

func (ContactBeginEvent) Name() string

func (ContactBeginEvent) ProtoDescriptor added in v0.16.4

func (c ContactBeginEvent) ProtoDescriptor() protoreflect.MessageDescriptor

func (ContactBeginEvent) SizeWire added in v0.16.9

func (c ContactBeginEvent) SizeWire() int

func (ContactBeginEvent) ToProto added in v0.15.0

func (ContactBeginEvent) UnmarshalWire added in v0.15.0

func (c ContactBeginEvent) UnmarshalWire(data []byte) (any, error)

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) AppendWire added in v0.16.9

func (c ContactEndEvent) AppendWire(b []byte) []byte

func (ContactEndEvent) FromProto added in v0.15.0

func (ContactEndEvent) MarshalWire added in v0.15.0

func (c ContactEndEvent) MarshalWire() []byte

func (ContactEndEvent) Name

func (ContactEndEvent) Name() string

func (ContactEndEvent) ProtoDescriptor added in v0.16.4

func (c ContactEndEvent) ProtoDescriptor() protoreflect.MessageDescriptor

func (ContactEndEvent) SizeWire added in v0.16.9

func (c ContactEndEvent) SizeWire() int

func (ContactEndEvent) ToProto added in v0.15.0

func (ContactEndEvent) UnmarshalWire added in v0.15.0

func (c ContactEndEvent) UnmarshalWire(data []byte) (any, error)

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.

func (ContactEventPayload) AppendWire added in v0.16.9

func (c ContactEventPayload) AppendWire(b []byte) []byte

func (ContactEventPayload) FromProto added in v0.15.0

func (ContactEventPayload) SizeWire added in v0.16.9

func (c ContactEventPayload) SizeWire() int

func (ContactEventPayload) ToProto added in v0.15.0

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).

func (FixtureFilterBits) AppendWire added in v0.16.9

func (c FixtureFilterBits) AppendWire(b []byte) []byte

func (FixtureFilterBits) FromProto added in v0.15.0

func (FixtureFilterBits) SizeWire added in v0.16.9

func (c FixtureFilterBits) SizeWire() int

func (FixtureFilterBits) ToProto added in v0.15.0

type TriggerBeginEvent

type TriggerBeginEvent struct {
	ContactEventPayload
}

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

func (TriggerBeginEvent) AppendWire added in v0.16.9

func (c TriggerBeginEvent) AppendWire(b []byte) []byte

func (TriggerBeginEvent) FromProto added in v0.15.0

func (TriggerBeginEvent) MarshalWire added in v0.15.0

func (c TriggerBeginEvent) MarshalWire() []byte

func (TriggerBeginEvent) Name

func (TriggerBeginEvent) Name() string

func (TriggerBeginEvent) ProtoDescriptor added in v0.16.4

func (c TriggerBeginEvent) ProtoDescriptor() protoreflect.MessageDescriptor

func (TriggerBeginEvent) SizeWire added in v0.16.9

func (c TriggerBeginEvent) SizeWire() int

func (TriggerBeginEvent) ToProto added in v0.15.0

func (TriggerBeginEvent) UnmarshalWire added in v0.15.0

func (c TriggerBeginEvent) UnmarshalWire(data []byte) (any, error)

type TriggerEndEvent

type TriggerEndEvent struct {
	ContactEventPayload
}

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

func (TriggerEndEvent) AppendWire added in v0.16.9

func (c TriggerEndEvent) AppendWire(b []byte) []byte

func (TriggerEndEvent) FromProto added in v0.15.0

func (TriggerEndEvent) MarshalWire added in v0.15.0

func (c TriggerEndEvent) MarshalWire() []byte

func (TriggerEndEvent) Name

func (TriggerEndEvent) Name() string

func (TriggerEndEvent) ProtoDescriptor added in v0.16.4

func (c TriggerEndEvent) ProtoDescriptor() protoreflect.MessageDescriptor

func (TriggerEndEvent) SizeWire added in v0.16.9

func (c TriggerEndEvent) SizeWire() int

func (TriggerEndEvent) ToProto added in v0.15.0

func (TriggerEndEvent) UnmarshalWire added in v0.15.0

func (c TriggerEndEvent) UnmarshalWire(data []byte) (any, error)

Jump to

Keyboard shortcuts

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