RigsOfRods / rigs-of-rods

Main development repository for Rigs of Rods soft-body physics simulator
https://www.rigsofrods.org
GNU General Public License v3.0
990 stars 175 forks source link

✨ Add option for Keyboard Steering Sensitivity #3120

Open cryham opened 5 months ago

cryham commented 5 months ago

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.

cryham commented 4 months ago

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 commented 4 months ago

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 commented 4 months ago

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 commented 4 months ago

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 commented 4 months ago

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 commented 4 months ago

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 commented 4 months ago

Screenshot_20240207_234555s Is this okay?

CuriousMike56 commented 4 months ago

Much better 👍

ohlidalp commented 4 months ago

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 commented 3 months ago

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

cryham commented 3 months ago

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 commented 3 months ago

https://github.com/RigsOfRods/rigs-of-rods/assets/46073351/ae61c1a3-8489-440d-ae23-bc3a34624b35

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 commented 3 months ago

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 commented 3 months ago

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

cryham commented 2 months ago

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.