Code refactor, create chain

This commit is contained in:
sam
2026-03-16 20:50:59 +05:45
parent 8ed94fac32
commit 27c9778001
3 changed files with 192 additions and 408 deletions
+6 -21
View File
@@ -17,26 +17,6 @@ static_index_global :: struct
Don't put game's logic here
*/
joint_common :: struct
{
entity_a, entity_b : static_index,
bodyIdA, bodyIdB : b2.BodyId,
}
revolt_joint_def :: struct
{
//Everything else can be stored in the def
entity_a, entity_b : static_index,
using def : b2.RevoluteJointDef,
}
distance_joint_def :: struct
{
entity_a, entity_b : static_index,
using def : b2.DistanceJointDef,
}
engine_world :: struct
{
world_id : b2.WorldId,
@@ -60,6 +40,7 @@ engine_world :: struct
engine_entity_flags_enum :: enum u64 {
POLYGON_IS_BOX,
MULTI_BODIES,
CHAIN,
MULTI_SHAPES,
}
@@ -82,7 +63,11 @@ engine_entity_def :: struct {
index : static_index,
body_count : int,
//For chain bodies
//It will replicate itself to the body count and connect themselves with rev_joints
body_count : i32,
rev_joint : b2.RevoluteJointDef,
half_link_length : f32
}
engine_entity :: struct {