update helpers
[carveJwlIkooP6JGAAIwe30JlM.git] / player_ragdoll.h
1 #ifndef PLAYER_RAGDOLL_H
2 #define PLAYER_RAGDOLL_H
3
4 #include "player_api.h"
5 #include "skeleton.h"
6 #include "rigidbody.h"
7 #include "player_render.h"
8
9 struct player_ragdoll{
10 struct ragdoll_part{
11 u32 bone_id;
12
13 /* Collider transform relative to bone */
14 m4x3f collider_mtx,
15 inv_collider_mtx;
16
17 v4f prev_q;
18 v3f prev_co;
19
20 u32 use_limits;
21 v3f limits[2];
22
23 rb_object obj;
24 u32 parent;
25 u32 colour;
26 }
27 parts[32];
28 u32 part_count;
29
30 rb_constr_pos position_constraints[32];
31 u32 position_constraints_count;
32
33 rb_constr_swingtwist cone_constraints[32];
34 u32 cone_constraints_count;
35
36 int shoes[2];
37 };
38
39 static float k_ragdoll_floatyiness = 20.0f,
40 k_ragdoll_floatydrag = 1.0f,
41 k_ragdoll_limit_scale = 1.0f;
42
43 static int k_ragdoll_div = 1,
44 ragdoll_frame = 0,
45 k_ragdoll_debug_collider = 1,
46 k_ragdoll_debug_constraints = 0;
47
48 static void player_ragdoll_init(void);
49 static void player_init_ragdoll_bone_collider( struct skeleton_bone *bone,
50 struct ragdoll_part *rp );
51 static u32 ragdoll_bone_parent( struct player_ragdoll *rd, u32 bone_id );
52 static void setup_ragdoll_from_skeleton( struct skeleton *sk,
53 struct player_ragdoll *rd );
54 static void copy_ragdoll_pose_to_localplayer( struct player_ragdoll *rd );
55 static void copy_localplayer_to_ragdoll( struct player_ragdoll *rd, v3f v );
56 static void player_debug_ragdoll(void);
57 static void player_ragdoll_iter( struct player_ragdoll *rd );
58
59 #endif /* PLAYER_RAGDOLL_H */