update helpers/location to 'frosted' ui
[carveJwlIkooP6JGAAIwe30JlM.git] / vehicle.h
1 #pragma once
2 #include "vg/vg_rigidbody.h"
3 #include "player.h"
4 #include "world.h"
5 #include "world_physics.h"
6
7 static float k_car_spring = 1.0f,
8 k_car_spring_damp = 0.001f,
9 k_car_spring_length = 0.5f,
10 k_car_wheel_radius = 0.2f,
11 k_car_friction_lat = 0.6f,
12 k_car_friction_roll = 0.01f,
13 k_car_drive_force = 1.0f,
14 k_car_air_resistance = 0.1f,
15 k_car_downforce = 0.5f;
16
17 typedef struct drivable_vehicle drivable_vehicle;
18 struct drivable_vehicle
19 {
20 int alive, inside;
21 rigidbody rb;
22
23 v3f wheels[4];
24
25 float tangent_mass[4][2],
26 normal_forces[4],
27 tangent_forces[4][2];
28
29 float steer, drive;
30 v3f steerv;
31
32 v3f tangent_vectors[4][2];
33 v3f wheels_local[4];
34 }
35 extern gzoomer;
36
37 int spawn_car( int argc, const char *argv[] );
38 void vehicle_init(void);
39 void vehicle_wheel_force( int index );
40 void vehicle_solve_friction(void);
41 void vehicle_update_fixed(void);
42 void vehicle_update_post(void);