Cockpit Inertia in XWA

A Forum dedicated to the Suggestion, Creation and Editing of XWA Dynamic Link Library Files

Moderator: JeremyaFr

Post Reply

Cockpit Inertia in XWA

User avatar
blue_max
XWAU Member
Posts: 2295
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Sun Mar 29, 2020 7:36 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

User avatar
Vince T
Fleet Admiral (Administrator)
Posts: 14045
Joined: Fri Apr 27, 2001 11:01 pm
Contact:

Post by Vince T » Sun Mar 29, 2020 8:46 am

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

User avatar
Phoenix Leader
Rebel Alliance
Posts: 437
Joined: Wed Aug 08, 2018 2:20 pm

Post by Phoenix Leader » Sun Mar 29, 2020 12:58 pm

Amazing! Reminds me of the X-Wing in Rogue Squadron 3D.

User avatar
DarHan
Rebel Alliance
Posts: 325
Joined: Mon Dec 05, 2005 12:01 am
Contact:

Post by DarHan » Sun Mar 29, 2020 6:23 pm

Neat! This has been one of the features I’ve wished XWA had.
“Red Four, nothing’s gone wrong yet.”
— Hobbie Klivian

User avatar
Driftwood
Admiral (Moderator)
Posts: 2174
Joined: Wed Oct 22, 2003 11:01 pm
Contact:

Post by Driftwood » Mon Mar 30, 2020 12:16 am

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.

User avatar
blue_max
XWAU Member
Posts: 2295
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Mon Mar 30, 2020 10:44 pm

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.
Last edited by blue_max on Tue Mar 31, 2020 8:48 pm, edited 1 time in total.

User avatar
keiranhalcyon7
Lieutenant JG
Posts: 599
Joined: Tue Jan 02, 2018 6:41 am

Post by keiranhalcyon7 » Tue Mar 31, 2020 7:10 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.)

User avatar
blue_max
XWAU Member
Posts: 2295
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » 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

User avatar
keiranhalcyon7
Lieutenant JG
Posts: 599
Joined: Tue Jan 02, 2018 6:41 am

Post by keiranhalcyon7 » 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. 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?

User avatar
blue_max
XWAU Member
Posts: 2295
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Fri Apr 24, 2020 7:43 pm

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!

User avatar
Ace Antilles
Admiral (Moderator)
Posts: 7829
Joined: Sat Jan 22, 2000 12:01 am
Contact:

Post by Ace Antilles » Sun Apr 26, 2020 12:11 am

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?
Chief XWAU Team annoying nitpicker.
Ace Antilles - The X-Wing Outpost
Image

User avatar
keiranhalcyon7
Lieutenant JG
Posts: 599
Joined: Tue Jan 02, 2018 6:41 am

Post by keiranhalcyon7 » Sun Apr 26, 2020 1:22 am

Ace - read the content of the post you quoted, from the bottom up.

User avatar
Ace Antilles
Admiral (Moderator)
Posts: 7829
Joined: Sat Jan 22, 2000 12:01 am
Contact:

Post by Ace Antilles » Sun Apr 26, 2020 1:42 am

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 ;)
Chief XWAU Team annoying nitpicker.
Ace Antilles - The X-Wing Outpost
Image

User avatar
blue_max
XWAU Member
Posts: 2295
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » 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

User avatar
Ace Antilles
Admiral (Moderator)
Posts: 7829
Joined: Sat Jan 22, 2000 12:01 am
Contact:

Post by Ace Antilles » Sun Apr 26, 2020 3:35 pm

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
Chief XWAU Team annoying nitpicker.
Ace Antilles - The X-Wing Outpost
Image

User avatar
blue_max
XWAU Member
Posts: 2295
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Fri May 01, 2020 6:11 am

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

User avatar
keiranhalcyon7
Lieutenant JG
Posts: 599
Joined: Tue Jan 02, 2018 6:41 am

Post by keiranhalcyon7 » Fri Jun 12, 2020 6:44 am

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?

User avatar
blue_max
XWAU Member
Posts: 2295
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Fri Jun 12, 2020 4:15 pm

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.

Post Reply