Page 1 of 1

Cockpit Inertia in XWA

Posted: Sun Mar 29, 2020 7:36 am
by blue_max
Many flight- and space-sims implement some sort of cockpit inertia. This feature is finally coming to XWA inside the Cockpit Look Hook.

I think it's easier to just take a look at this video to see what I'm talking about:

https://www.youtube.com/watch?v=gFR6a1- ... e=youtu.be

Re: Cockpit Inertia in XWA

Posted: Sun Mar 29, 2020 8:46 am
by General_Trageton
Woah! I have waited a long time for this moment!

Re: Cockpit Inertia in XWA

Posted: Sun Mar 29, 2020 12:58 pm
by Phoenix Leader
Amazing! Reminds me of the X-Wing in Rogue Squadron 3D.

Re: Cockpit Inertia in XWA

Posted: Sun Mar 29, 2020 6:23 pm
by DarHan
Neat! This has been one of the features I’ve wished XWA had.

Re: Cockpit Inertia in XWA

Posted: Mon Mar 30, 2020 12:16 am
by Driftwood
Who would have thought such a "simple" addition would have such a profound effect. Now I'm left wondering as to why I've never noticed the lack of this function prior to this video.

Re: Cockpit Inertia in XWA

Posted: Mon Mar 30, 2020 10:44 pm
by blue_max
Alright, here's a preview of this effect. I put it inside the cockpit look hook, so here it is for people that would like to try it out ahead of the formal release:

EDIT: I've updated the hook to include a minor fix for TrackIR users (cockpit inertia was disabled if TrackIR was selected; but turned off):

https://www.dropbox.com/s/21k7rusihaea4 ... 0.dll?dl=0

(You'll need release 1.1.1 of the VR mod and you'll also need to replace the existing Hook_CockpitLook.dll with the above)

To enable this, you'll need to add the following lines to CockpitLook.cfg

cockpit_inertia_enabled = 1
cockpit_inertia = 0.35
cockpit_max_inertia = 0.2

"cockpit_inertia" is the speed of the effect. A value of 0 will disable it. Don't use values higher than 0.5 or the cockpit will start shaking when turning sharply.
"cockpit_max_inertia" is the limit the extent of the effect. Using high values will shake the cockpit.

The inertia will glitch when entering hyperspace because XWA resets the cockpit orientation at that point. I'm aware of this problem and I'm testing a fix right now; but there may be other bugs.

Re: Cockpit Inertia in XWA

Posted: Tue Mar 31, 2020 7:10 am
by keiranhalcyon7
Haven't tried it yet, but the video looks great... a little exaggerated, like all these previews, but I see that it's scalable. Question: Does it work for (ac/de)celeration as well, or just pitch/yaw? There've been times when my engines got shot out, when it would have been really useful to have a more visceral indicator that I'm slowing down. (Ok, maybe about as useful as knowing the exact height and weight of the bear charging you, but still.)

Re: Cockpit Inertia in XWA

Posted: Tue Mar 31, 2020 7:21 pm
by blue_max
As with pretty much everything I've done, the effect can be toned down or disabled altogether. Adding acceleration sounds like a great idea. It's not implemented; but it's doable. I assume the current speed is stored somewhere in the PlayerDataTable? Would you have any idea where I should look?

EDIT: I think I found the setting in PlayerDataTable, I'll try to code the accel/decel too, thanks for the suggestion!

EDIT 2: Acceleration and deceleration have been implemented: https://www.dropbox.com/s/1q3rjlmxmt15p ... 0.dll?dl=0
To enable cockpit inertia, add the following to CockpitLook.cfg:

cockpit_inertia_enabled = 1
cockpit_inertia = 0.35
cockpit_max_inertia = 0.2
cockpit_speed_inertia = 0.005

Re: Cockpit Inertia in XWA

Posted: Fri Apr 24, 2020 8:47 am
by keiranhalcyon7
Finally tried this out. It's nice, but it's still a little raw - that is, it feels jerky & jumpy. I would request two things - could you average the last few frames' contributions to reduce jerkiness, and is there a way to increase the granularity so the motions are smoother/less jumpy?

Sorry, make that three requests - roll?

Re: Cockpit Inertia in XWA

Posted: Fri Apr 24, 2020 7:43 pm
by blue_max
keiranhalcyon7 wrote:
Fri Apr 24, 2020 8:47 am
Finally tried this out. It's nice, but it's still a little raw - that is, it feels jerky & jumpy.
Did you use the settings I put above?
I would request two things - could you average the last few frames' contributions to reduce jerkiness, and is there a way to increase the granularity so the motions are smoother/less jumpy?
I wonder why your experience was so jumpy... There's one thing you've got to understand: I semi-hijacked the cockpit shake to do this. In every frame, XWA will try to reduce the cockpit shake, while the cockpit inertia will try to push it in some direction. So, they will conflict with each other all the time. This is going to happen no matter how many frames I average, and I think it's easier to notice when the inertia is tending to 0 because it tends to overcompensate because of the above. The only way to ensure a 100% smooth effect is to eliminate cockpit shake altogether (or at least hook it, so that we can control it better).

Having said that, I'm already averaging 2 frames; but I can add more to see if that helps a little.
Sorry, make that three requests - roll?
What you're essentially asking for is to do "cockpit camera roll". This is currently not possible -- but if you know a way to enable that, please let me know!

Re: Cockpit Inertia in XWA

Posted: Sun Apr 26, 2020 12:11 am
by Ace Antilles
blue_max wrote:
Tue Mar 31, 2020 7:21 pm
As with pretty much everything I've done, the effect can be toned down or disabled altogether. Adding acceleration sounds like a great idea. It's not implemented; but it's doable. I assume the current speed is stored somewhere in the PlayerDataTable? Would you have any idea where I should look?

EDIT: I think I found the setting in PlayerDataTable, I'll try to code the accel/decel too, thanks for the suggestion!

EDIT 2: Acceleration and deceleration have been implemented: https://www.dropbox.com/s/1q3rjlmxmt15p ... 0.dll?dl=0
To enable cockpit inertia, add the following to CockpitLook.cfg:

cockpit_inertia_enabled = 1
cockpit_inertia = 0.35
cockpit_max_inertia = 0.2
cockpit_speed_inertia = 0.005
Sorry, not sure I am personally liking this Intertia thing. I think it's what is slightly giving me a few play issues.
Realism in space isn't for everyone lol Will there be an on/off switch or just delete code?

Re: Cockpit Inertia in XWA

Posted: Sun Apr 26, 2020 1:22 am
by keiranhalcyon7
Ace - read the content of the post you quoted, from the bottom up.

Re: Cockpit Inertia in XWA

Posted: Sun Apr 26, 2020 1:42 am
by Ace Antilles
keiranhalcyon7 wrote:
Sun Apr 26, 2020 1:22 am
Ace - read the content of the post you quoted, from the bottom up.
I was more thinking of in game toggle for people to try and change as they wanted.
The random person (more random than me) won't know lol
Also what about the external_inertia setting? If I set it to enabled = 0 then I get the external view spinning again.
I've messed up enough lately so taking it slowly ;)

Re: Cockpit Inertia in XWA

Posted: Sun Apr 26, 2020 3:33 am
by blue_max
Ace Antilles wrote:
Sun Apr 26, 2020 1:42 am
I was more thinking of in game toggle for people to try and change as they wanted.
That's a good idea, I can add that feature
Also what about the external_inertia setting? If I set it to enabled = 0 then I get the external view spinning again.
This might be a new bug, try the following settings:

external_inertia_enabled = 1
external_inertia = 0
external_max_inertia = 0.0
external_tilt = -10.0

Re: Cockpit Inertia in XWA

Posted: Sun Apr 26, 2020 3:35 pm
by Ace Antilles
blue_max wrote:
Sun Apr 26, 2020 3:33 am
Ace Antilles wrote:
Sun Apr 26, 2020 1:42 am
I was more thinking of in game toggle for people to try and change as they wanted.
That's a good idea, I can add that feature
Also what about the external_inertia setting? If I set it to enabled = 0 then I get the external view spinning again.
This might be a new bug, try the following settings:

external_inertia_enabled = 1
external_inertia = 0
external_max_inertia = 0.0
external_tilt = -10.0
Yeah if I have this below and your settings above then the craft will not spin with the cockpit_inertia_enabled = 0
Thanks a lot

; Cockipt Inertia
cockpit_inertia_enabled = 0
cockpit_inertia = 0.35
cockpit_max_inertia = 0.2
cockpit_speed_inertia = 0.005

Re: Cockpit Inertia in XWA

Posted: Fri May 01, 2020 6:11 am
by blue_max
Also what about the external_inertia setting? If I set it to enabled = 0 then I get the external view spinning again.
This *was* a bug in the cockpit look hook. I've fixed it and you can download the new version here (along with sample CFG files, etc):

https://www.dropbox.com/s/q9ycitmaduzl8 ... 4.zip?dl=0

Re: Cockpit Inertia in XWA

Posted: Fri Jun 12, 2020 6:44 am
by keiranhalcyon7
blue_max wrote:
Fri Apr 24, 2020 7:43 pm
I wonder why your experience was so jumpy... There's one thing you've got to understand: I semi-hijacked the cockpit shake to do this. In every frame, XWA will try to reduce the cockpit shake, while the cockpit inertia will try to push it in some direction.
Your comment about off-axis cameras in the VR distortion topic reminded me of this. Question: how do you do camera translation for VR? Could you implement cockpit inertia the same way, so the effect isn't fighting with the engine?

Re: Cockpit Inertia in XWA

Posted: Fri Jun 12, 2020 4:15 pm
by blue_max
keiranhalcyon7 wrote:
Fri Jun 12, 2020 6:44 am
Your comment about off-axis cameras in the VR distortion topic reminded me of this. Question: how do you do camera translation for VR? Could you implement cockpit inertia the same way, so the effect isn't fighting with the engine?
For camera translation in VR I'm also hijacking the same variables I used for cockpit inertia. So, when you move around in VR you're also fighting the engine and sometimes it's a little shaky. For some reason, I don't perceive it as much with the headset on, though.