kafelix496 / collide-fns

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

collide-fns

to check collision detection, I chose to use SAT (Separating Axis Theorem)

according to wikipedia, the SAT (separating axis theorem) can be applied for fast collision detection between polygon meshes. Each face's normal or other feature direction is used as a separating axis. Note that this yields possible separating axes, not separating lines/planes.

Install

npm install @share-code/collide-fns

Functions

isCollide

check the two objects are collided. it's pretty obvious but each vertexes should have more than 3 vertex.

interface Vertex {
  x: number
  y: number
}

isCollide = (aVertexes: Vertex[], bVertexes: Vertex[]) => boolean

License

MIT

About

License:MIT License


Languages

Language:TypeScript 80.1%Language:JavaScript 19.9%