Elastic collisions of Sphere using Ebiten game library.
Collisions is a simple elastic collisions simulator of two spheres in a 2D space.
It calculates the velocities and directions of the spheres after collisions, using linear algebra and avoiding the use of complex trigonometry.
The vector operations needed to calculate the elastic collision are simply outlined in the doc 2-Dimensional Elastic Collisions without Trigonometry written by @vobarian.
I have not imported any external library for the vector operations, I wrote vectors.go with few basic functions.
Collisions is made of four packages:
I used Ebiten - a simple graphics library to build games in Go.
go run main.go
A while ago I wrote something similar in Java, but I wasn’t happy with the result and I did not share it.
Now, I am learning Go, and I decided to resume that old idea to write my Hello Word in Go.
Some ideas are:
Feel free to clone this project and expand it at your whish.