1
0
Fork 0
mirror of https://github.com/k4zmu2a/SpaceCadetPinball.git synced 2024-11-17 07:10:18 +01:00

Fixed HardHit detection in DefaultCollision.

Issue #141.
This commit is contained in:
Muzychenko Andrey 2022-06-15 09:10:24 +03:00
parent 5e42f37fba
commit eed3662592

View file

@ -60,14 +60,17 @@ bool TCollisionComponent::DefaultCollision(TBall* ball, vector2* nextPosition, v
return false;
}
bool collision = false;
auto projSpeed = maths::basic_collision(ball, nextPosition, direction, Elasticity, Smoothness, Threshold, Boost);
if (projSpeed > Threshold)
{
loader::play_sound(HardHitSoundId, ball, "TCollisionComponent1");
collision = true;
}
else if (projSpeed > 0.2f)
loader::play_sound(SoftHitSoundId, ball, "TCollisionComponent2");
else
return false;
return true;
return collision;
}
void TCollisionComponent::Collision(TBall* ball, vector2* nextPosition, vector2* direction,