From 7ed124593ebda443fc4d0f1439d1fd8dc602ce72 Mon Sep 17 00:00:00 2001 From: rodri Date: Sun, 1 Aug 2021 11:56:12 +0000 Subject: =?UTF-8?q?began=20building=20a=20universe=20for=20every=20party.?= =?UTF-8?q?=20get=20rid=20of=20the=20notes=20file.=20i=20already=20keep=20?= =?UTF-8?q?them=20on=20paper.=20adapted=20the=20client=20to=20use=20an=20r?= =?UTF-8?q?frame=20for=20drawing.=20implemented=20some=20VModel=20methods?= =?UTF-8?q?=20for=20testing.=20FPS2MS=20=E2=86=92=20HZ2MS.=20it=20makes=20?= =?UTF-8?q?more=20sense=20and=20is=20shorter.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- physics.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'physics.c') diff --git a/physics.c b/physics.c index 945ff8c..a1edf54 100644 --- a/physics.c +++ b/physics.c @@ -18,6 +18,25 @@ accel(GameState *s, double) return Vec2(0, -k*s->p.y - b*s->v.y); } +/* + * XXX: remember to take thrust into account, based on user input. + */ +static Point2 +accelship(Universe *u, Ship *s, double) +{ + double g, d; + + d = vec2len(subpt2(u->star.p, s->p)); + g = G*u->star.mass/(d*d); + return mulpt2(normvec2(subpt2(u->star.p, s->p)), g); +} + +static Point2 +accelbullet(Universe *, Bullet *, double) +{ + return Vec2(0,0); +} + static Derivative eval(GameState *s0, double t, double Δt, Derivative *d) { -- cgit v1.2.3