Skip to content

zergon321/cirno

Repository files navigation

Cirno GoDoc

An easy to use collision detection and resolution library written in Go programming language. The library is still in development and the API might change.

Installation

No C dependencies required to compile the library. Just use the following command to install it.

go get github.com/zergon321/cirno

Tutorial

The tutorial series explains how to use different API methods and data types of Cirno to handle everything related to collisions in games.

Examples

All the example programs using the library are located in examples directory. Pixel is required to run any of them. The most important demos are described below.

  • benchmark - a small demo application that creates 1000 rectangles, randomly moves and rotates them and serches for collisions between them. It clearly showcases quad tree in action;

  • contacts - a small demo application that showcases finding contact points between shape outlines;

  • raycast - a small demo application that showcases raycast, just like Physics2D.Raycast from Unity;

  • sliding - a small demo that showcases shapes movement with sliding collision.

Games

The most noteable game created with Cirno at the current time is a Touhou style danmaku demo. The less noteable one is a tiny platrformer level in examples directory.

Danmaku Platformer
Danmaku Platformer

If you have a game using Cirno and you want it to be present in this list, just create a new PR with your changes to the README.

Features

  • Shapes to attach to game objects to detect and resolve collisions between them:
    • circle;
    • line segment (or just line);
    • rectangle (OBB, oriented bounding box).
  • Quadtree space index
  • Raycast
  • Contacts finding methods
  • Normal computing methods
  • Movement and rotation approximation
  • Tag system

Contributing

For minor and unimportant errors such as typos please just create issues instead of PRs fixing them.

Code changes adding features, optimizations, tests and bugfixes are welcome. All the contributions in examples directory should be really small, preferrably one-file. If your game is quite big, consider placing links to it in the list of games in the README.