diff --git a/build_physics.bat b/build_physics.bat new file mode 100644 index 0000000..28ba824 --- /dev/null +++ b/build_physics.bat @@ -0,0 +1,8 @@ +@echo off + +:buildloop +jai -natvis physics.jai +if %errorlevel% neq 0 ( + pause + goto buildloop +) diff --git a/physics.jai b/physics.jai index 8cd89e4..eaa10bc 100644 --- a/physics.jai +++ b/physics.jai @@ -59,7 +59,6 @@ LastingPip :: struct { pips : [10] LastingPip; push_pip :: (at: Vector2) { - Debug.breakpoint(); for * pips { if it.alive_for <= 0.0 @@ -108,11 +107,14 @@ apply_force_at_point :: (r: *Rect, force: Vector2, point_world_space: Vector2) { r.torque += offset_from_center_of_mass.x * force.y - offset_from_center_of_mass.y * force.x; } apply_impulse_at_point :: (using r: *Rect, impulse: Vector2, point_world_space: Vector2) { - //apply_force_at_point(r, impulse / TIMESTEP, point_world_space); - //return; + #if false + { + apply_force_at_point(r, impulse / TIMESTEP, point_world_space); +} else { vel += impulse / r.mass; angle_vel += length(impulse) * (cross(point_world_space - pos, normalize(impulse))/moment_of_inertia(r)); } +} // everything needed to resolve the collision Manifold :: struct { a, b: *Rect; @@ -514,8 +516,8 @@ main :: () { rects: [..]Rect; array_add(*rects, .{pos = #run xy(0.0, 0.0), halfsize = #run xy(0.3)}); - array_add(*rects, .{pos = #run xy(2.5, 0.0), halfsize = #run xy(0.3)}); - array_add(*rects, .{pos = #run xy(-2.5, 0.0), halfsize = #run xy(0.3)}); + //array_add(*rects, .{pos = #run xy(2.5, 0.0), halfsize = #run xy(0.3)}); + //array_add(*rects, .{pos = #run xy(-2.5, 0.0), halfsize = #run xy(0.3)}); array_add(*rects, .{pos = #run xy(0.0, -3.0), halfsize = #run xy(3.0, 0.2), static = true}); quit := false; @@ -562,7 +564,7 @@ main :: () { if get_time() < 0.5 { - apply_force_at_point(*rects[0], xy(3, 0), rects[0].pos + xy(-0.1, 0.03)); + //apply_force_at_point(*rects[0], xy(3, 0), rects[0].pos + xy(-0.1, 0.03)); } collisions: [..] Manifold; defer array_free(collisions); diff --git a/tooling.ahk b/tooling.ahk new file mode 100644 index 0000000..7081cf3 --- /dev/null +++ b/tooling.ahk @@ -0,0 +1,30 @@ +#NoEnv +#SingleInstance, Force +SendMode, Input +SetBatchLines, -1 +SetWorkingDir, %A_ScriptDir% + +; Fuck windows for having this hardcoded +^Esc::return + +^b:: +Runwait, build_physics.bat +SetTitleMatchMode, 2 +WinActivate Visual +Sleep 100 +Send, {F5} +Send, {Ctrl down}{Shift down}{F5}{Ctrl up}{Shift up} +; Send, {F5} +return + + +WinKill, Flight Hosting +WinKill, Flight Not Hosting +WinActivate, flightbuild +If WinActive("flightbuild") +{ + Send, {Enter} + Send, remedybg continue-execution && timeout 1 && remedybg.exe stop-debugging && shadergen.bat && msbuild && remedybg.exe start-debugging {Enter} +} +Send, {Blind} ; So it doesn't hold down ctrl after running! WTF +return