module Gphys:sig..end
Simple 2D physics
typevector =float * float
typepoint =float * float
typesegment =point * point
type 'a circle = {
|
mutable cx : |
|
mutable cy : |
|
mutable r : |
|
mutable vx : |
|
mutable vy : |
|
mutable static : |
|
custom : |
}
val update_circles : 'a circle list ->
segment list -> vector -> float -> float -> unitUpdate 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)