GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - setanarut/coll: 2d collision library for Go

BranchesTags
Open more actions menu

Latest commit

 

History

95 Commits
95 Commits

Folders and files

NameName
Last commit message
Last commit date
examples
examples
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
box_box_contain.go
box_box_contain.go
 
 
box_box_inner_sweep1.go
box_box_inner_sweep1.go
 
 
box_box_overlap.go
box_box_overlap.go
 
 
box_box_sweep1.go
box_box_sweep1.go
 
 
box_box_sweep2.go
box_box_sweep2.go
 
 
box_circle_overlap.go
box_circle_overlap.go
 
 
box_circle_sweep2.go
box_circle_sweep2.go
 
 
box_orientedbox_overlap.go
box_orientedbox_overlap.go
 
 
box_orientedbox_sweep2.go
box_orientedbox_sweep2.go
 
 
box_point_overlap.go
box_point_overlap.go
 
 
box_seg_overlap.go
box_seg_overlap.go
 
 
box_seg_sweep1.go
box_seg_sweep1.go
 
 
box_segs_sweep1_indexed.go
box_segs_sweep1_indexed.go
 
 
box_tilemap_sweep.go
box_tilemap_sweep.go
 
 
circle_circle_sweep2.go
circle_circle_sweep2.go
 
 
circle_point_overlap.go
circle_point_overlap.go
 
 
coll.go
coll.go
 
 
go.mod
go.mod
 
 
go.sum
go.sum
 
 
line_circle_overlap.go
line_circle_overlap.go
 
 
ray_tilemap_dda.go
ray_tilemap_dda.go
 
 
seg_circle_overlap.go
seg_circle_overlap.go
 
 
shapes.go
shapes.go
 
 

Repository files navigation

GoDoc

coll - 2d collision library for Go

Features

  • Collisions only - no gravity, rigid body handling, or complex solvers
  • Is data-oriented and functional

Conventions

"Sweep" tests indicate at least 1 of the objects is moving. The number indicates how many objects are moving. e.g., box-box-sweep2 means we are comparing 2 aabbs, both of which are moving. "Overlap" tests don't take movement into account, and this is a static check to see if the 2 entities overlap. plural forms imply a collection. e.g., BoxSegmentsSweep1Indexed() checks one box segment against a set of line segments. If there is more than one collision, the closest collision is set in the h *Hit argument.

Visualization of some (but not all) functions

Box-Box overlap

Box-Box-overlap

Box-Box sweep 1

Box-Box sweep 1

Box-Box sweep 2

Box-Box sweep 2

Box-OrientedBox overlap

abb-obb-overlap

Box-Segment sweep 1

Box-Segment sweep 1

Box-Segments sweep 1 indexed

Box-Segments sweep 1

Box-Segment overlap

Box-Segment overlap

Line-Circle overlap

alt text

Segment-Circle overlap

alt text

Examples (Ebitengine)

  1. Clone this repository
  2. In the terminal, change to the examples directory cd examples
  3. Run a folder with go run ./foldername. Example: go run ./box_box_sweep1

Credits

Most of these collision checks were adapted from existing open source repos:

  • github.com/mreinstein/collision-2d
  • youtube.com/watch?v=NbSee-XM7WA - ray-tilemap (RayTilemapDDA)
  • jonathanwhiting.com/tutorial/collision - box-tilemap (TileCollider)

About

2d collision library for Go

pkg.go.dev/github.com/setanarut/coll

Topics

2d-collision2d-collision-checker2d-collision-libraryaabbaxis-aligned-bounding-boxcollision-detectioncollision-resolutiondda-algorithmebitenebitenginegame-developmentgogolanggolang-packageintersectionsat-solversweep-linesweep-line-algorithmtilemap-collision

Resources

Readme
MIT license
Activity

Stars

7 stars

Watchers

0 watching

Forks

1 fork
Report repository

Releases

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.