Files
asteroids/physics.h

32 lines
580 B
C

#ifndef PHYSICS_H
#define PHYSICS_H
#include "maths.h"
typedef struct {
vec2_t pos;
mat2_t dir;
vec2_t vel;
float rot;
float mass;
} physics_t;
typedef struct {
float dist, va, vb;
vec2_t norm;
} physics_sep_t;
void physics_init();
void physics_update();
void physics_add(
unsigned entity, vec2_t pos, mat2_t dir, vec2_t vel, float rot,
float mass);
physics_t *physics_get(unsigned entity);
void physics_escape(unsigned entity);
physics_sep_t physics_separation(unsigned a, unsigned b);
void physics_bounce(unsigned a, unsigned b, physics_sep_t sep);
#endif