-#ifndef PLAYER_RAGDOLL_H
-#define PLAYER_RAGDOLL_H
+#pragma once
+
+/*
+ * Copyright (C) 2021-2024 Mt.ZERO Software - All Rights Reserved
+ *
+ * Ragdoll system
+ */
#include "player_api.h"
#include "skeleton.h"
-#include "rigidbody.h"
+#include "vg/vg_rigidbody.h"
+#include "vg/vg_rigidbody_constraints.h"
#include "player_render.h"
struct player_ragdoll{
u32 use_limits;
v3f limits[2];
- rb_object obj;
u32 parent;
u32 colour;
+
+ rigidbody rb;
+ enum bone_collider type;
+
+ union {
+ rb_capsule capsule;
+ boxf box;
+ }
+ inf;
}
parts[32];
u32 part_count;
rb_constr_swingtwist cone_constraints[32];
u32 cone_constraints_count;
+ /* TODO: Fix duplicated data */
+ u32 constraint_associations[32][2];
int shoes[2];
};
static float k_ragdoll_floatyiness = 20.0f,
k_ragdoll_floatydrag = 1.0f,
- k_ragdoll_limit_scale = 1.0f;
+ k_ragdoll_limit_scale = 1.0f,
+ k_ragdoll_spring = 127.0f,
+ k_ragdoll_dampening = 15.0f,
+ k_ragdoll_correction = 0.5f,
+ k_ragdoll_angular_drag = 0.08f,
+ k_ragdoll_active_threshold = 5.0f;
static int k_ragdoll_div = 1,
ragdoll_frame = 0,
static void player_debug_ragdoll(void);
static void player_ragdoll_iter( struct player_ragdoll *rd );
-
-#endif /* PLAYER_RAGDOLL_H */