From cab4376cc78dd9ffb13a7965cf2615ba1648c8f1 Mon Sep 17 00:00:00 2001 From: Sam Anthony Date: Mon, 28 Oct 2024 11:46:02 -0400 Subject: gravity --- balls.cl | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'balls.cl') diff --git a/balls.cl b/balls.cl index b48e0ab..e3450db 100644 --- a/balls.cl +++ b/balls.cl @@ -1,3 +1,6 @@ +#define G_FACTOR 3600.0 +#define G (9.81 / G_FACTOR) + float min(float a, float b) { if (a < b) @@ -22,6 +25,7 @@ move(__global float2 *positions, __global float2 *velocities) { size_t id; id = get_global_id(0); + velocities[id].y -= G; positions[id] += velocities[id]; } -- cgit v1.2.3