diff --git a/.gitattributes b/.gitattributes index 7bac928..a4a7a72 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,3 +3,4 @@ *.jpg filter=lfs diff=lfs merge=lfs -text *.jpeg filter=lfs diff=lfs merge=lfs -text *.blend filter=lfs diff=lfs merge=lfs -text +*.blend1 filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore index 2554662..2e2d2ff 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,6 @@ *.dll *.exp *.rdi -*.obj *.lib log.txt *.bin @@ -16,4 +15,4 @@ log.txt linux atlas.png pdbs/ -game_web/ \ No newline at end of file +game_web/ diff --git a/assets/box.obj b/assets/box.obj new file mode 100644 index 0000000..0f9c2a6 --- /dev/null +++ b/assets/box.obj @@ -0,0 +1,18 @@ +# Blender 4.2.3 LTS +# www.blender.org +o Cube +v -1.000000 1.000000 1.000000 +v -1.000000 -1.000000 1.000000 +v -1.000000 1.000000 -1.000000 +v -1.000000 -1.000000 -1.000000 +v 1.000000 1.000000 1.000000 +v 1.000000 -1.000000 1.000000 +v 1.000000 1.000000 -1.000000 +v 1.000000 -1.000000 -1.000000 +s 0 +f 1 5 7 3 +f 4 3 7 8 +f 8 7 5 6 +f 6 2 4 8 +f 2 1 3 4 +f 6 5 1 2 diff --git a/assets/car_convex.obj b/assets/car_convex.obj new file mode 100644 index 0000000..e6b6f67 --- /dev/null +++ b/assets/car_convex.obj @@ -0,0 +1,80 @@ +# Blender 4.3.2 +# www.blender.org +o Object_5 +v -1.841497 0.441915 2.882739 +v -1.528260 -0.439969 4.246670 +v -1.532271 -0.014560 4.306011 +v -1.458986 0.585761 4.084804 +v -1.169056 1.845618 -0.044352 +v -1.794738 0.759021 -2.991723 +v -1.751396 -0.067717 -3.937637 +v 1.598544 -0.437865 4.228289 +v -1.355442 0.205843 4.443853 +v -1.495447 -0.513379 -3.072723 +v -1.081991 -0.669625 2.507290 +v 1.152275 -0.667619 2.498550 +v 0.035142 0.587956 4.202047 +v 0.035142 1.889431 -0.088813 +v 0.035142 1.953676 -2.216545 +v -1.179023 1.913049 -2.281286 +v -1.418515 1.165435 -4.711776 +v -1.589515 0.055308 -5.153280 +v 1.558805 0.203133 4.425279 +v 1.565731 -0.511086 -3.071773 +v 1.821680 -0.067717 -3.937637 +v 1.911781 0.441916 2.882739 +v 0.035142 -0.194318 -4.868722 +v 1.529270 0.585761 4.084804 +v 1.239340 1.845618 -0.044352 +v 1.249308 1.913049 -2.281285 +v 1.488799 1.165434 -4.711775 +v 0.035142 1.168489 -4.782736 +v 0.035142 0.107657 -5.212766 +v 1.659799 0.055307 -5.153279 +v 1.865023 0.759021 -2.991723 +s 0 +f 1 2 3 +f 1 3 4 +f 1 4 5 +f 31 26 25 22 +f 1 6 7 +f 1 7 2 +f 2 9 3 +f 2 7 10 +f 2 10 11 +f 20 12 11 10 +f 3 9 4 +f 4 9 13 +f 24 25 14 13 +f 25 26 15 14 +f 6 16 17 +f 6 17 18 +f 6 18 7 +f 7 18 10 +f 8 12 20 +f 8 20 21 +f 8 21 22 +f 8 22 19 +f 9 19 13 +f 10 18 23 +f 10 23 20 +f 8 19 9 2 +f 13 19 24 +f 15 16 5 14 +f 27 28 15 26 +f 17 16 15 28 +f 29 18 17 28 +f 29 28 27 30 +f 18 29 30 +f 18 30 23 +f 19 22 24 +f 20 23 30 +f 20 30 21 +f 21 31 22 +f 21 30 31 +f 22 25 24 +f 26 31 27 +f 12 8 2 11 +f 27 31 30 +f 14 5 4 13 +f 5 16 6 1 diff --git a/game/game.odin b/game/game.odin index 08e727a..9faf5af 100644 --- a/game/game.odin +++ b/game/game.odin @@ -379,7 +379,7 @@ update_runtime_world :: proc(runtime_world: ^Runtime_World, dt: f32) { turn_wheels := []physics.Suspension_Constraint_Handle{wheel_fl, wheel_fr} DRIVE_IMPULSE :: 10 - BRAKE_IMPULSE :: 20 + BRAKE_IMPULSE :: 10 TURN_ANGLE :: -f32(30) * math.RAD_PER_DEG for wheel_handle in drive_wheels { diff --git a/game/physics/debug.odin b/game/physics/debug.odin index 05f8f9f..4d43881 100644 --- a/game/physics/debug.odin +++ b/game/physics/debug.odin @@ -105,17 +105,20 @@ draw_debug_scene :: proc(scene: ^Scene) { if true { for &contact, contact_idx in scene.contact_pairs[:scene.contact_pairs_len] { - points_a := contact.manifold.points_a[:contact.manifold.points_len] - points_b := contact.manifold.points_b[:contact.manifold.points_len] - debug_transform_points_local_to_world(get_body(scene, contact.a), points_a) + points_a := contact.manifold.points_a + points_b := contact.manifold.points_b + points_a_slice, points_b_slice := + points_a[:contact.manifold.points_len], points_b[:contact.manifold.points_len] + debug_transform_points_local_to_world(get_body(scene, contact.a), points_a_slice) + debug_transform_points_local_to_world(get_body(scene, contact.b), points_b_slice) debug_draw_manifold_points( -contact.manifold.normal, - contact.manifold.points_a[:contact.manifold.points_len], + points_a_slice, color = debug.int_to_color(i32(contact_idx * 2 + 0)), ) debug_draw_manifold_points( contact.manifold.normal, - points_b, + points_b_slice, color = debug.int_to_color(i32(contact_idx * 2 + 1)), ) } diff --git a/game/physics/simulation.odin b/game/physics/simulation.odin index c91342e..ea21402 100644 --- a/game/physics/simulation.odin +++ b/game/physics/simulation.odin @@ -240,7 +240,7 @@ simulate_step :: proc(scene: ^Scene, config: Solver_Config) { ) contact_pair.lambda_tangent[point_idx] = lambda_tangent - STATIC_FRICTION :: 0.3 + STATIC_FRICTION :: 0.7 if ok_tangent && lambda_tangent < lambda_norm * STATIC_FRICTION { apply_correction(body, corr1_tangent, p1) diff --git a/src_assets/car_convex.blend b/src_assets/car_convex.blend index 1b13577..a6e5701 100644 --- a/src_assets/car_convex.blend +++ b/src_assets/car_convex.blend @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:623e3253f8d1fb99d8082230a0e02425634ce29e62f58f62c5d5758793ad0588 -size 905120 +oid sha256:3763a97f1176bcbe7b2ef9b3db200ead0fe4b27ae314d7866c67d9d616968186 +size 510084 diff --git a/src_assets/car_convex.blend1 b/src_assets/car_convex.blend1 index e6d5156..9609249 100644 Binary files a/src_assets/car_convex.blend1 and b/src_assets/car_convex.blend1 differ