Fix convex mesh to remove coplanar faces, fix contact debug visualizer
This commit is contained in:
parent
25ff57168b
commit
ef51a9ee30
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -3,3 +3,4 @@
|
|||||||
*.jpg filter=lfs diff=lfs merge=lfs -text
|
*.jpg filter=lfs diff=lfs merge=lfs -text
|
||||||
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
||||||
*.blend filter=lfs diff=lfs merge=lfs -text
|
*.blend filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.blend1 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -6,7 +6,6 @@
|
|||||||
*.dll
|
*.dll
|
||||||
*.exp
|
*.exp
|
||||||
*.rdi
|
*.rdi
|
||||||
*.obj
|
|
||||||
*.lib
|
*.lib
|
||||||
log.txt
|
log.txt
|
||||||
*.bin
|
*.bin
|
||||||
@ -16,4 +15,4 @@ log.txt
|
|||||||
linux
|
linux
|
||||||
atlas.png
|
atlas.png
|
||||||
pdbs/
|
pdbs/
|
||||||
game_web/
|
game_web/
|
||||||
|
18
assets/box.obj
Normal file
18
assets/box.obj
Normal file
@ -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
|
80
assets/car_convex.obj
Normal file
80
assets/car_convex.obj
Normal file
@ -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
|
@ -379,7 +379,7 @@ update_runtime_world :: proc(runtime_world: ^Runtime_World, dt: f32) {
|
|||||||
turn_wheels := []physics.Suspension_Constraint_Handle{wheel_fl, wheel_fr}
|
turn_wheels := []physics.Suspension_Constraint_Handle{wheel_fl, wheel_fr}
|
||||||
|
|
||||||
DRIVE_IMPULSE :: 10
|
DRIVE_IMPULSE :: 10
|
||||||
BRAKE_IMPULSE :: 20
|
BRAKE_IMPULSE :: 10
|
||||||
TURN_ANGLE :: -f32(30) * math.RAD_PER_DEG
|
TURN_ANGLE :: -f32(30) * math.RAD_PER_DEG
|
||||||
|
|
||||||
for wheel_handle in drive_wheels {
|
for wheel_handle in drive_wheels {
|
||||||
|
@ -105,17 +105,20 @@ draw_debug_scene :: proc(scene: ^Scene) {
|
|||||||
|
|
||||||
if true {
|
if true {
|
||||||
for &contact, contact_idx in scene.contact_pairs[:scene.contact_pairs_len] {
|
for &contact, contact_idx in scene.contact_pairs[:scene.contact_pairs_len] {
|
||||||
points_a := contact.manifold.points_a[:contact.manifold.points_len]
|
points_a := contact.manifold.points_a
|
||||||
points_b := contact.manifold.points_b[:contact.manifold.points_len]
|
points_b := contact.manifold.points_b
|
||||||
debug_transform_points_local_to_world(get_body(scene, contact.a), points_a)
|
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(
|
debug_draw_manifold_points(
|
||||||
-contact.manifold.normal,
|
-contact.manifold.normal,
|
||||||
contact.manifold.points_a[:contact.manifold.points_len],
|
points_a_slice,
|
||||||
color = debug.int_to_color(i32(contact_idx * 2 + 0)),
|
color = debug.int_to_color(i32(contact_idx * 2 + 0)),
|
||||||
)
|
)
|
||||||
debug_draw_manifold_points(
|
debug_draw_manifold_points(
|
||||||
contact.manifold.normal,
|
contact.manifold.normal,
|
||||||
points_b,
|
points_b_slice,
|
||||||
color = debug.int_to_color(i32(contact_idx * 2 + 1)),
|
color = debug.int_to_color(i32(contact_idx * 2 + 1)),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -240,7 +240,7 @@ simulate_step :: proc(scene: ^Scene, config: Solver_Config) {
|
|||||||
)
|
)
|
||||||
contact_pair.lambda_tangent[point_idx] = lambda_tangent
|
contact_pair.lambda_tangent[point_idx] = lambda_tangent
|
||||||
|
|
||||||
STATIC_FRICTION :: 0.3
|
STATIC_FRICTION :: 0.7
|
||||||
if ok_tangent &&
|
if ok_tangent &&
|
||||||
lambda_tangent < lambda_norm * STATIC_FRICTION {
|
lambda_tangent < lambda_norm * STATIC_FRICTION {
|
||||||
apply_correction(body, corr1_tangent, p1)
|
apply_correction(body, corr1_tangent, p1)
|
||||||
|
BIN
src_assets/car_convex.blend
(Stored with Git LFS)
BIN
src_assets/car_convex.blend
(Stored with Git LFS)
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user