-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathphysics.h
49 lines (37 loc) · 1.02 KB
/
physics.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#pragma once
#include <stdint.h>
#include "terrain.h"
#include "world.h"
struct SpriteReq;
struct PhysicsIO
{
// INPUT:
// must be thresholded
float x_force;
float y_force;
float torque;
float water;
//bool slow;
// IO:
bool jump; // will be falsed by Animate() if jump was handled
// user should accumulate them
// physics will zero them only when handled
float x_impulse;
float y_impulse;
// OUTPUT:
float pos[3];
float yaw;
float player_dir;
int player_stp;
int dt;
bool grounded;
// what was this for?
//float xyz[64][3];
};
struct Physics;
int Animate(Physics* phys, uint64_t stamp, PhysicsIO* io, const SpriteReq* req, bool me); // return num of time steps handled
Physics* CreatePhysics(Terrain* t, World* w, float pos[3], float dir, float yaw, uint64_t stamp);
void DeletePhysics(Physics* phys);
void SetPhysicsPos(Physics* phys, float pos[3], float vel[3]);
void SetPhysicsYaw(Physics* phys, float yaw, float vel);
void SetPhysicsDir(Physics* phys, float dir);