From cd09b335f700ccbac9d3753e32cdda2c68d4f7b7 Mon Sep 17 00:00:00 2001 From: Meetric <73554599+meetric1@users.noreply.github.com> Date: Fri, 26 Jul 2024 19:52:22 -0400 Subject: [PATCH] fix majority of particle clipping issues --- binary/src/flex_solver.cpp | 6 +++--- binary/src/main.cpp | 6 +++--- lua/autorun/gwater2_init.lua | 10 +++++++++- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/binary/src/flex_solver.cpp b/binary/src/flex_solver.cpp index 247224c..8195a9d 100644 --- a/binary/src/flex_solver.cpp +++ b/binary/src/flex_solver.cpp @@ -353,8 +353,8 @@ FlexSolver::FlexSolver(NvFlexLibrary* library, int particles) { params->shockPropagation = 0.0f; params->restitution = 0.0f; - params->maxSpeed = 1e10; - params->maxAcceleration = 200.0f; + params->maxSpeed = 1e5; + params->maxAcceleration = 1e5; params->relaxationMode = eNvFlexRelaxationLocal; params->relaxationFactor = 0.25f; // only works with eNvFlexRelaxationGlobal params->solidPressure = 0.5f; @@ -367,7 +367,7 @@ FlexSolver::FlexSolver(NvFlexLibrary* library, int particles) { params->diffuseThreshold = 100.f; params->diffuseBuoyancy = 1.f; params->diffuseDrag = 0.8f; - params->diffuseBallistic = 0; + params->diffuseBallistic = 2; params->diffuseLifetime = 5.f; // not actually in seconds params->numPlanes = 0; diff --git a/binary/src/main.cpp b/binary/src/main.cpp index 7a392ad..b1a7876 100644 --- a/binary/src/main.cpp +++ b/binary/src/main.cpp @@ -506,9 +506,9 @@ LUA_FUNCTION(FLEXSOLVER_AddCube) { LUA_FUNCTION(FLEXSOLVER_AddForceField) { LUA->CheckType(1, FLEXSOLVER_METATABLE); LUA->CheckType(2, Type::Vector); - LUA->CheckNumber(3); - LUA->CheckNumber(4); - LUA->CheckNumber(5); + LUA->CheckNumber(3); // radius + LUA->CheckNumber(4); // strength + LUA->CheckNumber(5); // mode LUA->CheckType(6, Type::Bool); FlexSolver* flex = GET_FLEXSOLVER(1); diff --git a/lua/autorun/gwater2_init.lua b/lua/autorun/gwater2_init.lua index d536953..2f87ead 100644 --- a/lua/autorun/gwater2_init.lua +++ b/lua/autorun/gwater2_init.lua @@ -190,10 +190,18 @@ end) hook.Add("InitPostEntity", "gwater2_addprop", gwater2.reset_solver) hook.Add("OnEntityCreated", "gwater2_addprop", function(ent) timer.Simple(0, function() add_prop(ent) end) end) // timer.0 so data values are setup correctly -hook.Add("gwater2_pretick", "gravgun", function() +hook.Add("gwater2_pretick", "gwater2_gravgun_grab", function() local lp = LocalPlayer() if !lp:KeyDown(IN_ATTACK2) then return end if IsValid(LocalPlayer():GetActiveWeapon()) and LocalPlayer():GetActiveWeapon():GetClass() == "weapon_physcannon" then gwater2.solver:AddForceField(LocalPlayer():EyePos() + LocalPlayer():GetAimVector() * 170, 150, -200, 0, true) end +end) + +hook.Add("Think", "gwater2_gravgun_punt", function() -- + LocalPlayer():GetAimVector() * 85 + local lp = LocalPlayer() + if !lp:KeyPressed(IN_ATTACK) then return end + if IsValid(LocalPlayer():GetActiveWeapon()) and LocalPlayer():GetActiveWeapon():GetClass() == "weapon_physcannon" then + gwater2.solver:AddForceField(LocalPlayer():EyePos(), 300, 100, 1, false) + end end) \ No newline at end of file