Skip to content

Commit

Permalink
read ground height when calculating ball wind
Browse files Browse the repository at this point in the history
  • Loading branch information
fallahn committed Sep 25, 2024
1 parent a73227b commit a130017
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions crogine.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions samples/golf/buildnumber.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_ */
5 changes: 4 additions & 1 deletion samples/golf/src/golf/BallSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit a130017

Please sign in to comment.