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

added damping sine wave to model nose wheel bump on touchdown #32

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

lennox-xonnel
Copy link
Contributor

@lennox-xonnel lennox-xonnel commented Sep 13, 2021

This is a draft aiming to add the bump effect when the nose wheel touches down.

I added a damping sine wave to model the nose wheel bump on touchdown.
Since I'm not a real life pilot, I'm not quite sure how big the effect is and which variables might affect it (I imagine many, like wheel pressure and nose down speed, if at all possible to be determined via a dataref, tho we might want to limit the model to a few). For this reason, every damping function parameters are exposed as dataref so that they can be modified and tested in game. It would be nice if someone with real life experience could try it and tell me what parameters feel the best.

The function has the form:

y(t) = - A * e^-(L*t) * sin(2 * PI * F * t)

where:

  • y: is the camera position offset on the y axis
  • A: is the initial amplitude (simcoders/headshake/touchdowncamera/bump_initial_amplitude) [default value: 0.03]
  • L: is the decay rate (simcoders/headshake/touchdowncamera/bump_decay_rate) [default value: 1]
  • F: is the frequency (simcoders/headshake/touchdowncamera/bump_frequency) [default value: 1]

At the moment, the nose wheel touchdown check is performed assuming the nose wheel is the first in the sim/flightmodel2/gear/on_ground array dataref, but we might want to perform a better check, testing the position of each wheel using the sim/aircraft/parts/acf_gear_znodef in order to establish which wheel is the furthest forward.

All code is unfinished and unpolished, everything will be cleaned up in future commits.

Closes #28

@nico87
Copy link
Contributor

nico87 commented Sep 20, 2021

In real life the view does not shake, of course, but you get the feeling of the wheel touching down.
I believe the best feeling is given by a vertical shacking with a very little roll of the view (as as damped sine wave). The hardest the impact of the front wheel, the strongest should be the effect.

@lennox-xonnel
Copy link
Contributor Author

lennox-xonnel commented Sep 22, 2021

Unfortunately, judging from the datarefs, there seems to be no way to get the vertical speed of the nose wheel, but I'm new to XP plugin development so I could be wrong.

As for the "vertical shaking with a very little roll of the view" do you mean that, apart from the movement I already implemented on the vertical axis, it would be nice to have a roll on the longitudinal axis?

It's implemented using the "sim/aircraft/parts/acf_gear_znodef" dataref.
Taildraggers are excluded.
@nico87
Copy link
Contributor

nico87 commented Sep 26, 2021

In the datarefs there's no direct reading of the vertical speed of the nose wheel but in other plugins I just used the pitch speed to detect this kind of movement. A quick change of pitch means that the nose wheel is going to hit the ground pretty hard.

With "vertical shaking with a very little roll of the view" I mean a roll along the longitudinal axis, as you mentioned.

@lennox-xonnel
Copy link
Contributor Author

Understood, I'll try to implement it! Would you mind pointing me in the right direction with the dataref I can use to gauge the pitch speed? Thank you

@nico87
Copy link
Contributor

nico87 commented Oct 13, 2021

I would use "sim/flightmodel/position/true_theta" to get the current pitch. In the flightloop you can get the elapsed time. Tracking the change of pitch in time you get the pitch speed. :-)

@lennox-xonnel
Copy link
Contributor Author

I added the requested features, if you could try it and let me know it would be great.
When everything will work as expected, I'll tidy up the code.

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.

Bump on the nose gear touch down
2 participants