Cockpit Inertia in XWA
Moderator: JeremyaFr
Cockpit Inertia in XWA
- blue_max
- Posts: 2296
- Joined: Wed Mar 20, 2019 5:12 am
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
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
- Vince T
- Posts: 14052
- Joined: Fri Apr 27, 2001 11:01 pm
- Contact:
Woah! I have waited a long time for this moment!
Your ship, Captain. I need a drink. - Vince Trageton
Vince T's X-Wing HQ - where the bad guys get their gear
Vince T's X-Wing HQ - where the bad guys get their gear
- Phoenix Leader
- Posts: 437
- Joined: Wed Aug 08, 2018 2:20 pm
Amazing! Reminds me of the X-Wing in Rogue Squadron 3D.
- DarHan
- Posts: 325
- Joined: Mon Dec 05, 2005 12:01 am
- Contact:
Neat! This has been one of the features I’ve wished XWA had.
“Red Four, nothing’s gone wrong yet.”
— Hobbie Klivian
— Hobbie Klivian
- Driftwood
- Posts: 2174
- Joined: Wed Oct 22, 2003 11:01 pm
- Contact:
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.
- blue_max
- Posts: 2296
- Joined: Wed Mar 20, 2019 5:12 am
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.
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.
Last edited by blue_max on Tue Mar 31, 2020 8:48 pm, edited 1 time in total.
- keiranhalcyon7
- Posts: 599
- Joined: Tue Jan 02, 2018 6:41 am
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.)
- blue_max
- Posts: 2296
- Joined: Wed Mar 20, 2019 5:12 am
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
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
- keiranhalcyon7
- Posts: 599
- Joined: Tue Jan 02, 2018 6:41 am
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?
Sorry, make that three requests - roll?
- blue_max
- Posts: 2296
- Joined: Wed Mar 20, 2019 5:12 am
Did you use the settings I put above?keiranhalcyon7 wrote: ↑Fri Apr 24, 2020 8:47 amFinally tried this out. It's nice, but it's still a little raw - that is, it feels jerky & 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).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?
Having said that, I'm already averaging 2 frames; but I can add more to see if that helps a little.
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!Sorry, make that three requests - roll?
- Ace Antilles
- Posts: 7901
- Joined: Sat Jan 22, 2000 12:01 am
- Contact:
Sorry, not sure I am personally liking this Intertia thing. I think it's what is slightly giving me a few play issues.blue_max wrote: ↑Tue Mar 31, 2020 7:21 pmAs 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
Realism in space isn't for everyone lol Will there be an on/off switch or just delete code?
- keiranhalcyon7
- Posts: 599
- Joined: Tue Jan 02, 2018 6:41 am
Ace - read the content of the post you quoted, from the bottom up.
- Ace Antilles
- Posts: 7901
- Joined: Sat Jan 22, 2000 12:01 am
- Contact:
I was more thinking of in game toggle for people to try and change as they wanted.keiranhalcyon7 wrote: ↑Sun Apr 26, 2020 1:22 amAce - read the content of the post you quoted, from the bottom up.
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
- blue_max
- Posts: 2296
- Joined: Wed Mar 20, 2019 5:12 am
That's a good idea, I can add that featureAce Antilles wrote: ↑Sun Apr 26, 2020 1:42 amI was more thinking of in game toggle for people to try and change as they wanted.
This might be a new bug, try the following settings:Also what about the external_inertia setting? If I set it to enabled = 0 then I get the external view spinning again.
external_inertia_enabled = 1
external_inertia = 0
external_max_inertia = 0.0
external_tilt = -10.0
- Ace Antilles
- Posts: 7901
- Joined: Sat Jan 22, 2000 12:01 am
- Contact:
Yeah if I have this below and your settings above then the craft will not spin with the cockpit_inertia_enabled = 0blue_max wrote: ↑Sun Apr 26, 2020 3:33 amThat's a good idea, I can add that featureAce Antilles wrote: ↑Sun Apr 26, 2020 1:42 amI was more thinking of in game toggle for people to try and change as they wanted.
This might be a new bug, try the following settings:Also what about the external_inertia setting? If I set it to enabled = 0 then I get the external view spinning again.
external_inertia_enabled = 1
external_inertia = 0
external_max_inertia = 0.0
external_tilt = -10.0
Thanks a lot
; Cockipt Inertia
cockpit_inertia_enabled = 0
cockpit_inertia = 0.35
cockpit_max_inertia = 0.2
cockpit_speed_inertia = 0.005
- blue_max
- Posts: 2296
- Joined: Wed Mar 20, 2019 5:12 am
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):Also what about the external_inertia setting? If I set it to enabled = 0 then I get the external view spinning again.
https://www.dropbox.com/s/q9ycitmaduzl8 ... 4.zip?dl=0
- keiranhalcyon7
- Posts: 599
- Joined: Tue Jan 02, 2018 6:41 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?
- blue_max
- Posts: 2296
- Joined: Wed Mar 20, 2019 5:12 am
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.keiranhalcyon7 wrote: ↑Fri Jun 12, 2020 6:44 amYour 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?