improve trainingmode collision sound

This commit is contained in:
milek7
2020-11-01 20:49:03 +01:00
parent 124f6bca0c
commit bbf0102e16
4 changed files with 16 additions and 5 deletions

View File

@@ -124,9 +124,16 @@ basic_cell::update_events() {
// event launchers
for( auto *launcher : m_eventlaunchers ) {
glm::dvec3 campos = Global.pCamera.Pos;
double radius = launcher->dRadius;
if (launcher->train_triggered && simulation::Train) {
campos = simulation::Train->Dynamic()->HeadPosition();
radius *= Timer::GetDeltaTime() * simulation::Train->Dynamic()->GetVelocity() * 0.277;
}
if( launcher->check_conditions()
&& ( launcher->dRadius < 0.0
|| SquareMagnitude( launcher->location() - Global.pCamera.Pos ) < launcher->dRadius ) ) {
&& ( radius < 0.0
|| glm::distance2( launcher->location(), campos ) < launcher->dRadius ) ) {
if( launcher->check_activation() )
launch_event( launcher, true );
if( launcher->check_activation_key() )