Hello everyone, recently I was playing with the DTG-produced model 'DB BR261 - Voith Gravita' and became very interested in its control system. So I managed to take a look at its script and found something like this: 'Call("SetControlTargetValue", "VirtualBrake", 0, 0)'. I would like to ask everyone, what does 'SetControlTargetValue' mean, and what is its function?
This is the link of that addon https://store.steampowered.com/app/...strecke_Leipzig__Riesa_Route_Extension_AddOn/
A control has a interpolated movement to a new position when used by input devices like mouse, keyboard or game pad. The input sets a targeted value and the game then moves the control to that targeted value multiplied by the set interaction speed and inter frame time (delta time). When setting a control directly via script with SetControlValue it snaps immediately to the new set position without the interpolation. SetControlTargetValue sets only the targeted value as with the input devices and the game moves the control to that targeted position then by the interpolation. From my experiences it works not on all controls, especially not the hard coded ones. But works for most self defined controls.
btw,I want to make a power handle like it.Can you teach me? It means automatically returning to a certain value after the user completes an action (for example, using the control lever in the cockpit, controlling with the keyboard, or dragging the HUD with the mouse), while not locking the user out during the reset process
Doesn't this depend on your frame rate? So if you have very low or high frame rate it will impact the time it takes for the control to reach the target, which isn't optimal. In this case, the brakes will apply/release quicker if you have very high frame rate? Can you give some more info about this power handle? This could be done very easily with a virtual control, but it depends on how it works irl.
When the power handle is in gear 1, the regulator value is 0. In gear 2, the regulator is 0.1. In gear 3, the regulator value gradually decreases. In gear 4, the regulator remains unchanged(Hold). In gear 5, the regulator gradually increases.When Regulator less then 0.1 and the power handle is in gear 3,the power handle was set to gear 2
Right. Some controls are doing that, what is a pain. I have scripted some important levers therefor and bound them to the interframe time in stead of the frame rate. So they act independent from the framerate. But lots of extra work to achieve that and two more controls in the list for each lever you want to "fix".