From a13001753d1835b0539ffa396f134236d70dc138 Mon Sep 17 00:00:00 2001 From: fallahn Date: Wed, 25 Sep 2024 13:50:35 +0100 Subject: [PATCH] read ground height when calculating ball wind --- crogine.sln | 4 ++-- samples/golf/buildnumber.h | 4 ++-- samples/golf/src/golf/BallSystem.cpp | 5 ++++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/crogine.sln b/crogine.sln index 540ca0548..84621f210 100644 --- a/crogine.sln +++ b/crogine.sln @@ -703,8 +703,8 @@ Global {B1559428-CDF8-4797-8766-0EA62BDD6D1B}.Release|Any CPU.ActiveCfg = Release|Win32 {B1559428-CDF8-4797-8766-0EA62BDD6D1B}.Release|ARM.ActiveCfg = Release|Win32 {B1559428-CDF8-4797-8766-0EA62BDD6D1B}.Release|ARM64.ActiveCfg = Release|Win32 - {B1559428-CDF8-4797-8766-0EA62BDD6D1B}.Release|x64.ActiveCfg = Release|x64 - {B1559428-CDF8-4797-8766-0EA62BDD6D1B}.Release|x64.Build.0 = Release|x64 + {B1559428-CDF8-4797-8766-0EA62BDD6D1B}.Release|x64.ActiveCfg = ReleaseGNS|x64 + {B1559428-CDF8-4797-8766-0EA62BDD6D1B}.Release|x64.Build.0 = ReleaseGNS|x64 {B1559428-CDF8-4797-8766-0EA62BDD6D1B}.Release|x86.ActiveCfg = Release|Win32 {B1559428-CDF8-4797-8766-0EA62BDD6D1B}.Release|x86.Build.0 = Release|Win32 {B1559428-CDF8-4797-8766-0EA62BDD6D1B}.Release-asan|Any CPU.ActiveCfg = Release-asan|Win32 diff --git a/samples/golf/buildnumber.h b/samples/golf/buildnumber.h index cec3aa09c..e808364fd 100644 --- a/samples/golf/buildnumber.h +++ b/samples/golf/buildnumber.h @@ -3,7 +3,7 @@ #ifndef BUILD_NUMBER_H_ #define BUILD_NUMBER_H_ -#define BUILDNUMBER 7158 -#define BUILDNUMBER_STR "7158" +#define BUILDNUMBER 7160 +#define BUILDNUMBER_STR "7160" #endif /* BUILD_NUMBER_H_ */ diff --git a/samples/golf/src/golf/BallSystem.cpp b/samples/golf/src/golf/BallSystem.cpp index a06ea1f84..f6bb6b6c2 100644 --- a/samples/golf/src/golf/BallSystem.cpp +++ b/samples/golf/src/golf/BallSystem.cpp @@ -390,8 +390,11 @@ void BallSystem::processEntity(cro::Entity entity, float dt) //add gravity ball.velocity += Gravity * dt; + const auto t = getTerrain(tx.getPosition(), glm::vec3(0.f, -1.f, 0.f), 60.f); + const auto height = std::clamp(-t.penetration, 0.f, 60.f); + //add wind - auto multiplier = getWindMultiplier(tx.getPosition().y - ball.startPoint.y, glm::length(m_holeData->pin - tx.getPosition())); + auto multiplier = getWindMultiplier(/*tx.getPosition().y - ball.startPoint.y*/height, glm::length(m_holeData->pin - tx.getPosition())); ball.velocity += m_windDirection * m_windStrength * multiplier * dt; ball.windEffect = m_windStrength * multiplier;