Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Play a metal creaking sound at rapid acceleration change #5335

Merged
merged 3 commits into from
May 20, 2022
Merged

Play a metal creaking sound at rapid acceleration change #5335

merged 3 commits into from
May 20, 2022

Conversation

WKFO
Copy link
Contributor

@WKFO WKFO commented Jan 31, 2022

I'm attempting to write a bit of C++ code here, ̷s̷i̷n̷c̷e̷ ̷S̷h̷i̷p̷.̷c̷p̷p̷ ̷s̷e̷e̷m̷s̷ ̷t̷o̷ ̷b̷e̷ ̷t̷h̷e̷ ̷p̷l̷a̷c̷e̷ ̷t̷o̷ ̷d̷o̷ ̷s̷h̷i̷p̷ ̷s̷o̷u̷n̷d̷s̷.̷ ̷(̷A̷l̷s̷o̷ ̷S̷h̷i̷p̷.̷c̷p̷p̷ ̷a̷l̷r̷e̷a̷d̷y̷ ̷h̷a̷s̷ ̷t̷h̷e̷ ̷c̷o̷n̷v̷e̷n̷i̷e̷n̷t̷ ̷u̷t̷i̷l̷i̷t̷i̷e̷s̷ ̷l̷i̷k̷e̷ ̷G̷e̷t̷M̷a̷s̷s̷(̷)̷ ̷e̷t̷c̷.̷)̷

̷T̷h̷i̷s̷ ̷c̷o̷d̷e̷ ̷c̷o̷m̷p̷a̷r̷e̷s̷ ̷t̷h̷e̷ ̷l̷a̷s̷t̷ ̷f̷r̷a̷m̷e̷'̷s̷ ̷a̷c̷c̷e̷l̷e̷r̷a̷t̷i̷o̷n̷ ̷a̷n̷d̷ ̷t̷h̷i̷s̷ ̷f̷r̷a̷m̷e̷'̷s̷ ̷a̷c̷c̷e̷l̷e̷r̷a̷t̷i̷o̷n̷ ̷o̷n̷ ̷t̷h̷e̷ ̷p̷l̷a̷y̷e̷r̷ ̷s̷h̷i̷p̷,̷ ̷a̷n̷d̷ ̷i̷f̷ ̷t̷h̷e̷ ̷d̷i̷f̷f̷e̷r̷e̷n̷c̷e̷ ̷i̷n̷ ̷a̷c̷c̷e̷l̷e̷r̷a̷t̷i̷o̷n̷ ̷i̷s̷ ̷t̷o̷o̷ ̷g̷r̷e̷a̷t̷ ̷(̷5̷0̷ ̷m̷ ̷s̷-̷3̷ ̷t̷o̷ ̷b̷e̷ ̷s̷p̷e̷c̷i̷f̷i̷c̷)̷,̷ ̷i̷t̷ ̷m̷a̷k̷e̷s̷ ̷s̷o̷m̷e̷ ̷m̷e̷t̷a̷l̷ ̷c̷r̷e̷a̷k̷i̷n̷g̷ ̷s̷o̷u̷n̷d̷ ̷e̷f̷f̷e̷c̷t̷.̷ ̷T̷h̷e̷ ̷r̷e̷a̷s̷o̷n̷ ̷I̷'̷m̷ ̷l̷o̷o̷k̷i̷n̷g̷ ̷a̷t̷ ̷t̷h̷e̷ ̷d̷i̷f̷f̷e̷r̷e̷n̷c̷e̷ ̷i̷n̷ ̷a̷c̷c̷e̷l̷e̷r̷a̷t̷i̷o̷n̷ ̷(̷j̷e̷r̷k̷?̷)̷ ̷a̷n̷d̷ ̷n̷o̷t̷ ̷a̷c̷c̷e̷l̷e̷r̷a̷t̷i̷o̷n̷ ̷i̷t̷s̷e̷l̷f̷ ̷i̷s̷ ̷b̷e̷c̷a̷u̷s̷e̷ ̷s̷t̷r̷u̷c̷t̷u̷r̷e̷s̷ ̷s̷e̷t̷t̷l̷e̷ ̷a̷t̷ ̷e̷q̷u̷i̷l̷i̷b̷r̷i̷u̷m̷ ̷a̷t̷ ̷c̷o̷n̷s̷t̷.̷ ̷a̷c̷c̷e̷l̷.̷
Edit: No longer doing that, we look at last 5 frames of acceleration change.

In a lot of high-g cases this will probably be masked by airflow or engine sounds partially, but I thought it could still be a nice effect.

@WKFO
Copy link
Contributor Author

WKFO commented Jan 31, 2022

Now the code should look at last 5 frames to trigger the sound. This prevents thrusters from causing this metal sound, and allows me to lower the value limit to a more sensible one.

Copy link
Member

@sturnclaw sturnclaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not really a fan of the way this is implemented (in a general architectural sense), but it's about as clean an implementation as can be expected given our existing class hierarchy. I have no objections to merging this, but it will need to be refactored sooner or later.

@sturnclaw sturnclaw merged commit 458faa6 into pioneerspacesim:master May 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants