collider

package
v0.0.0-...-881dcfe Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collision

type Collision struct {
	Resolutions []CollisionResolution
}

func (Collision) Resolve

func (c Collision) Resolve() space.Vec2F

type CollisionResolution

type CollisionResolution struct {
	Object *Object
	Delta  space.Vec2F
}

type Object

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

func NewObject

func NewObject(pos space.Vec2F, size space.Vec2F, tags ...string) *Object

func (*Object) Center

func (o *Object) Center() space.Vec2F

Center returns the center of the object

func (*Object) Collide

func (o *Object) Collide(move space.Vec2F, tags ...string) *Collision

Collide returns the collision if the object collided with the other objects

func (*Object) CollideWith

func (o *Object) CollideWith(other *Object, move space.Vec2F) *space.Vec2F

CollideWith returns a delta vector if the object collided with the other object

func (*Object) ContainsPoint

func (o *Object) ContainsPoint(point space.Vec2F) bool

ContainsPoint returns true if the object contains the point

func (*Object) Intercepts

func (o *Object) Intercepts(other *Object) bool

Intercepts returns true if the object intercepts the other object

func (*Object) Move

func (o *Object) Move(move space.Vec2F)

func (*Object) Position

func (o *Object) Position() space.Vec2F

func (*Object) SetPosition

func (o *Object) SetPosition(pos space.Vec2F)

func (*Object) Size

func (o *Object) Size() space.Vec2F

func (*Object) StaticCollisionWith

func (o *Object) StaticCollisionWith(other *Object) *space.Vec2F

type World

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

func NewWorld

func NewWorld() *World

func (*World) Add

func (w *World) Add(objects ...*Object)

func (*World) Collide

func (w *World) Collide(obj *Object, move space.Vec2F, tags ...string) *Collision

func (*World) NewObject

func (w *World) NewObject(pos space.Vec2F, size space.Vec2F, tags ...string) *Object

func (*World) Objects

func (w *World) Objects() []*Object

func (*World) Remove

func (w *World) Remove(objects ...*Object)

Jump to

Keyboard shortcuts

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