Module Gphys

module Gphys: sig .. end

Simple 2D physics


type vector = float * float 
type point = float * float 
type segment = point * point 
type 'a circle = {
   cx : float;
   cy : float;
   r : float;
   vx : float;
   vy : float;
   static : bool;
   custom : 'a;
}
val update_circles : 'a circle list ->
segment list -> vector -> float -> float -> 'a circle list

Update the position of multiple circles and handle collisions with:

update_circles circles segments gravity dt restitution

restitution = 0.70, coefficient of restitution (0.70 means 30% energy loss)