Disable edge separation tests for now and make a stress test

This commit is contained in:
sergeypdev 2025-03-01 20:54:26 +04:00
parent 0f60cdda13
commit a1e8d0f231
5 changed files with 103 additions and 102 deletions

View File

@ -35,7 +35,7 @@ esac
# Build the game. # Build the game.
echo "Building game$DLL_EXT" echo "Building game$DLL_EXT"
odin build game -extra-linker-flags:"$EXTRA_LINKER_FLAGS" -define:RAYLIB_SHARED=true -define:TRACY_ENABLE=true -collection:libs=./libs -collection:common=./common -collection:game=./game -build-mode:dll -out:game_tmp$DLL_EXT -strict-style -vet -debug odin build game -extra-linker-flags:"$EXTRA_LINKER_FLAGS" -define:RAYLIB_SHARED=true -define:TRACY_ENABLE=true -collection:libs=./libs -collection:common=./common -collection:game=./game -build-mode:dll -out:game_tmp$DLL_EXT -strict-style -vet -debug -o:speed
# Need to use a temp file on Linux because it first writes an empty `game.so`, which the game will load before it is actually fully written. # Need to use a temp file on Linux because it first writes an empty `game.so`, which the game will load before it is actually fully written.
mv game_tmp$DLL_EXT game$DLL_EXT mv game_tmp$DLL_EXT game$DLL_EXT

View File

@ -260,12 +260,13 @@ update_runtime_world :: proc(runtime_world: ^Runtime_World, dt: f32) {
#hash("car", "fnv32a"), #hash("car", "fnv32a"),
physics.Body_Config { physics.Body_Config {
initial_pos = {0, 4, 0}, initial_pos = {0, 4, 0},
initial_rot = linalg.quaternion_angle_axis( initial_rot = linalg.QUATERNIONF32_IDENTITY,
math.RAD_PER_DEG * 180, // initial_rot = linalg.quaternion_angle_axis(
rl.Vector3{0, 0, 1}, // math.RAD_PER_DEG * 180,
) * // rl.Vector3{0, 0, 1},
linalg.quaternion_angle_axis(math.RAD_PER_DEG * 30, rl.Vector3{1, 0, 0}), // ) *
initial_ang_vel = {0, 0, 20}, // linalg.quaternion_angle_axis(math.RAD_PER_DEG * 30, rl.Vector3{1, 0, 0}),
initial_ang_vel = {0, 0, 0},
shape = physics.Shape_Convex { shape = physics.Shape_Convex {
mesh = car_convex.mesh, mesh = car_convex.mesh,
center_of_mass = car_convex.center_of_mass, center_of_mass = car_convex.center_of_mass,
@ -278,7 +279,7 @@ update_runtime_world :: proc(runtime_world: ^Runtime_World, dt: f32) {
if true { if true {
for x in 0 ..< 10 { for x in 0 ..< 10 {
for y in -3 ..< 10 { for y in -3 ..< 100 {
physics.immediate_body( physics.immediate_body(
&world.physics_scene, &world.physics_scene,
&runtime_world.solver_state, &runtime_world.solver_state,

View File

@ -180,6 +180,8 @@ query_separation_edges :: proc(
step := 0 step := 0
if false {
separating_plane_p: Vec3 separating_plane_p: Vec3
success_step: int success_step: int
@ -197,8 +199,6 @@ query_separation_edges :: proc(
continue continue
} }
tracy.ZoneN("collision.query_separation_edges::check_single_pair")
checked_pairs[pair] = true checked_pairs[pair] = true
if edge_a.twin >= 0 { if edge_a.twin >= 0 {
checked_pairs[{edge_a.twin, halfedge.Edge_Index(edge_b_idx)}] = true checked_pairs[{edge_a.twin, halfedge.Edge_Index(edge_b_idx)}] = true
@ -294,7 +294,7 @@ query_separation_edges :: proc(
} }
// log.debugf("step: %v", success_step) // log.debugf("step: %v", success_step)
// debug_draw_plane(separating_plane_p, separating_plane, rl.Color{228, 0, 48, 100}) // debug_draw_plane(separating_plane_p, separating_plane, rl.Color{228, 0, 48, 100})
}
return return
} }

View File

@ -3,7 +3,7 @@ package physics
import "collision" import "collision"
import lg "core:math/linalg" import lg "core:math/linalg"
MAX_CONTACTS :: 1024 MAX_CONTACTS :: 1024 * 16
Vec3 :: [3]f32 Vec3 :: [3]f32
Quat :: quaternion128 Quat :: quaternion128

View File

@ -170,7 +170,7 @@ simulate :: proc(
} }
} }
bvh.debug_draw_bvh_bounds(&sim_state_bvh, body_aabbs, 0) // bvh.debug_draw_bvh_bounds(&sim_state_bvh, body_aabbs, 0)
switch step_mode { switch step_mode {
case .Accumulated_Time: case .Accumulated_Time:
@ -507,7 +507,7 @@ simulate_step :: proc(
prev_v_normal := lg.dot(prev_v, manifold.normal) prev_v_normal := lg.dot(prev_v, manifold.normal)
v_normal := lg.dot(v, manifold.normal) v_normal := lg.dot(v, manifold.normal)
RESTITUTION :: 0.3 RESTITUTION :: 1
restitution := f32(RESTITUTION) restitution := f32(RESTITUTION)