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

✨ Add option for Keyboard Steering Sensitivity #3120

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

cryham
Copy link
Contributor

@cryham cryham commented Feb 3, 2024

So I added a new var and a slider on GUI for Keyboard Steering Sensitivity,
which is simply how fast you steer wheels with keyboard left/right. Default 1.0 is like it was before.
Depends on vehicle actually. Some had slow steering so 2.0 is fine for me now, some had okay and it's not needed above 1.2 etc.

Copy link
Member

@ohlidalp ohlidalp left a comment

Choose a reason for hiding this comment

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

Nice work.

Our steering actuators 'hydros' have user-defined extension lengths, so naturally each vehicle handles differently. The max. steering radius isn't defined, it comes out as result of the ext. length. I don't even know if the extension speed depends on length or is fixed. How does VDrift/StuntRally do this?

@cryham
Copy link
Contributor Author

cryham commented Feb 5, 2024

Well, VDrift/StuntRally just have classes that set wheel steer angle but nothing is physical. A setup file .car has max steering angle and all key inputs have sensivity etc. So it just sets angle from input directly.
And a wheel is only casting 1 ray down to get contact, this is really bad for big wheeled vehicles in SR.
But we have Pacejka Magic Formula with many (10 to 30) coefficients for tire simulation (SR has even an ingame editor for this).
I see RoR has some adhesion and other coefficents in FrictionSettings (we don't have that) like for all contacts, but no special curves for tires right?

@ohlidalp
Copy link
Member

ohlidalp commented Feb 5, 2024

Right. All our contacts are evaluated as node vs. surface, where surface is in charge of all the properties, node is dimensionless and frictionless point only. Tires are no exception, they are rolling frames and they are not built free-form but generated by *wheel* sections in our .truck defs, so they just have 2 rings of nodes (not optimal IMO) and user-adjustable number of radial segments. So segment count is the only way modder can affect grip.

@CuriousMike56
Copy link
Collaborator

Right. All our contacts are evaluated as node vs. surface, where surface is in charge of all the properties, node is dimensionless and frictionless point only. Tires are no exception, they are rolling frames and they are not built free-form but generated by *wheel* sections in our .truck defs, so they just have 2 rings of nodes (not optimal IMO) and user-adjustable number of radial segments. So segment count is the only way modder can affect grip.

Most vehicles use set_node_defaults to change wheel friction.

@cryham
Copy link
Contributor Author

cryham commented Feb 6, 2024

Okay thanks for info.
So what is the process for merging (this and other approved) PRs, does it go into further planning or roadmap etc?

BTW, could an administrator (IDK who) approve one of my accounts for RoR Forum, which I tried recently: CrystalHammer, Crystal Hammer or cryham? I did email contact, only email I found 6 days ago. Sorry IDK how else to contact, I'm not on discord.

@ohlidalp
Copy link
Member

ohlidalp commented Feb 6, 2024

Oh right, I forgot the 'friction coef' parameter of 'set_node_defaults' directive. So I was mistaken, the node actually does affect it's friction, the code is in Collisions.cpp, primitiveCollision(). Thanks Mike.

Merging this is just a matter of me (or few others) pushing the green button, I'll do it shortly. I'm really happy you took the effort of setting up the build and submitting a patch. I'll also look at your account.

@CuriousMike56
Copy link
Collaborator

Works well, though I'd recommend moving the option under vehicle control options and adding a reset button.
RoR_2024-02-06_15-01-07

@cryham
Copy link
Contributor Author

cryham commented Feb 7, 2024

Screenshot_20240207_234555s
Is this okay?

@CuriousMike56
Copy link
Collaborator

Much better 👍

@ohlidalp
Copy link
Member

ohlidalp commented Feb 9, 2024

Sorry about the delay on my end, I'll catch up on weekend.

Btw the button is a nice touch.

PS: on second look, it's not obvious to me what the 'Coupling' checkbox does now... Does it mix with the slider? Does the checkbox override the slider? I can't test it ATM

@ohlidalp ohlidalp self-requested a review March 11, 2024 19:17
@ohlidalp ohlidalp force-pushed the key-steering-sensitivity branch from 1267cec to 54e6794 Compare March 11, 2024 19:29
Copy link
Member

@ohlidalp ohlidalp left a comment

Choose a reason for hiding this comment

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

Tested, works great. I took the liberty to do a minor UI touch - I made the Reset button smaller and inline.
obrazek

@ohlidalp
Copy link
Member

There's a bug - when using controller, the smoothing only affects centering, not the actual steering: https://discord.com/channels/136544456244461568/189904947649708032/1216845086956982385

@cryham
Copy link
Contributor Author

cryham commented Mar 13, 2024

I'm not on discord so can't access.
I don't have a controller to test. So IDK if I can figure out why.
Is CalcHydros() same for both controller and keyboard, or does controller have some other code?
Does this happen with default 1.0 value too? Because generally I meant this issue for keyboard.
Also I thought of maybe 4.0 or less for range of this slider.

@CuriousMike56
Copy link
Collaborator

8mb.video-E6a-zDCJDXLc.mp4

Only happens with values higher than 1.0. At 5.0 it instantly snaps to center when the thumb stick is released. Assuming there's a conflict with the existing analog sensitivity/smoothing settings:
image

@cryham
Copy link
Contributor Author

cryham commented Mar 14, 2024

Ah ok interesting. I'll try finding out.
So the idea is to make it not do that right. Since it wasn't happening before.
Should return the same as for 1.0 even if set higher, for controllers.

@CuriousMike56
Copy link
Collaborator

Yes, ideally the slider shouldn't affect analog input.

@cryham
Copy link
Contributor Author

cryham commented Apr 13, 2024

Solution would something like:

            // return rate
            float dirdelta = analog ? PHYSICS_DT : App::io_hydro_sensivity->getFloat() * PHYSICS_DT;

IDK how to set analog though. It should be true when using analog game controller, and false for just keyboard.

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