From ed70472d52a2666a291cdd6850e25f23c49c9db4 Mon Sep 17 00:00:00 2001 From: Cameron Reikes Date: Fri, 23 Dec 2022 21:34:40 -0800 Subject: [PATCH] Emit on thrust, offset hash for uniqueness --- main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index fd11ae1..221bd6d 100644 --- a/main.c +++ b/main.c @@ -2249,10 +2249,12 @@ static void frame(void) if (b->box_type == BoxThruster) { // spawn particles + if(b->thrust > 0.0) { cpVect particle_vel = box_vel(b); - cpVect additional_vel = cpvmult(box_facing_vector(b), 0.5 + hash11(exec_time) * 0.2); // move outwards from thruster - additional_vel = cpvspin(additional_vel, hash11(exec_time) * 0.1); // some spin + double hash_offset = (double)get_id(&gs,b).index; // to make each thruster have a unique pattern of exhaust + cpVect additional_vel = cpvmult(box_facing_vector(b), 0.5 + hash11(exec_time + hash_offset) * 0.2); // move outwards from thruster + additional_vel = cpvspin(additional_vel, hash11(exec_time + hash_offset) * 0.1); // some spin particle_vel = cpvadd(particle_vel, additional_vel); new_particle(cpvadd(entity_pos(b), cpvmult(box_facing_vector(b), BOX_SIZE * 0.5)), particle_vel); }