This commit is contained in:
jonathan santis 2024-11-27 13:52:57 +01:00
parent 16541e4a69
commit 3149c01bc1
2 changed files with 6 additions and 6 deletions

View File

@ -83,9 +83,9 @@ const Particle = struct {
self.velocity.a.y += val;
}
pub fn applyForce(self : *Self,vec : pr.Vec) void {
self.velocity.a.x += vec.a.x * 0.5;
self.velocity.a.y += vec.a.y * 0.5;
self.velocity.a.z += vec.a.z;
self.acceleration.a.x += vec.a.x * 0.5;
self.acceleration.a.y += vec.a.y * 0.5;
self.acceleration.a.z += vec.a.z;
}
};
@ -135,7 +135,7 @@ const Emitter = struct
if(p.show == 1)
{
p.applyGravity(0);
p.applyGravity(2);
p.applyForce(att.attract(p.*));
p.applyForce(att2.attract(p.*));
p.update();
@ -157,8 +157,8 @@ const Attractor = struct
var vec = self.vec.sub(particle.position);
if( vec.a.x != 0 and vec.a.y != 0)
{
vec.a.x = vec.a.x/20;
vec.a.y = vec.a.y/20;
vec.a.x = vec.a.x/200;
vec.a.y = vec.a.y/200;
}
return vec;
}

Binary file not shown.