Upon setting my fps from 120 down to 60, my vehicle will be slightly faster, along with aerial physics also being increased. I will send images of the code upon requested. I’ve tried timers, substepping with the time between each generated frame etc… Nothing is yet to work.
In this video I set fps from 60 to 120. On the left is my speed cap. If you watch closely they end with different numbers depending on frame rate.
At the end of the suspension traces, there’s an “Accelerate function” this controls the force at which the vehicle will move at. (SPEED float in this image is set to 3500. This is multiplied by the “Accel input” which ranges if we’re either going forward or backward between -1 and 1)
And then finally… sorry this is kinda a lot so I do apologize if this is confusing. I have the function at which the acceleration is created from (the bottom img) I’m using get world delta seconds here so Im assuming this is what you mentioned. Then the top img is the actual input. (W to get the vehicle moving which then prints those numbers you see in the initial video) If you manage to figure something out then id be very happy, if not it’s totally ok, it’s a decent amount of stuff to help on
oh great, thanks for all those screens, those helps.
the forum downscales an its hard to read, but its good.
i see you use delta on the decceleration and acceleration.
but acceleration according to wikipedia is “Acceleration is the rate of change of velocity of an object with respect to time.”
so you missed one more delta second here. just add a pin and mulitply by delta seconds. (notice it will make your car super slow but that’s fine just increase the acceleration value )
It actually makes the vehicle go even slower on 120 than without it. Numbers are still different in the speed. I was trying to think if the error was something else to do with the code but I don’t have any speed based functions in the other parts of the code. Another thing too is the acceleration of upwards motion vastly is different from 120 to 60. I have a bounce pad which sends the car upward and instead of a mini hop, it launches the player about nearly 2X the height just with the 60 fps change.
So I’m unsure of really what to do to get it to work without depending on fps. Like I said, I tried timers and substepping but perhaps you know how to use them more efficiently? Im not sure. Thanks for the suggestion though.
twice when you double the fps sounds about right if youre not using delta time properly.
hmmmm im quite confident the DT should be multiplied on your accelerate function.
the question is when is that accelerate function being called. i assume is called on each tick.
i also think you’re confusing speed with acceleration. acceleration should be constant, unless you are trying to model something like a gas pedal (analog control). i will assume you are using analog controls.
Be careful when using finterpto to store in the same value as those wont give you a constant interpolation (since you are moving the start value). it’s long to explain and i’m short on time. you can find a vid on youtube im sure. i would say don’t use finterpto if current and or target change during the interp. use a lerp.
you don’t need to calculate and dampen the acceleration since that’s handled by the physics engine.
here’s what i’d do.
remove the code on IA_Accelerate
on ia_accelerate just store the current value in a variable. make sure the value is normalized (from 0 to 1). so use a lerp to remap, use a clamp.
On tick call Accelerate.
Accelerate should be
Pretty much what you have but replace acceleration input by the value from ia_accelerate.
You can call the value you get “AccelerationInput” but you need to remove the other code to not confuse the meaning.
also multiply by dt like i suggested earlier
you can add a branch before calling AddForceAt and only call if the IA_Accelerate value is >0.
SPEED is confusing. i’ll rename to MAX_SPEED. and make it constant. the actual speed is different. though i think youd call it velocity. note that the velocity and the dampening is happening on the AddFOrceAtLocation.
if you REALLY want to animate the acceleration, (for example you release the button but it keeps accelerating (for example an engine kinda works like that)). then you need to reintroduce that accelerationInput and calculate it properly. i bet that’s what’s causing issues. or maybe the input is processed at a rate that causes issues.
For that i’d:
have an function called UpdAccel
on it i’d do Acceleration= Acceleration -(AccelDamp*DT) + (AccelSpeed* DT*IA_accelValue)
Yes, “Accelerate” function does happen on each tick. (It’s inside the “Suspension Cast” function at the very end.
Upon setting a “Lerp” instead of Finterp to it turns into a mess. My input is delayed by around half a second and it moves very static-ee. I also had to crank up the speed from 200k to 1mil to get it actually moving.
Also the turning doesn’t work either when I do this
This is what happens when I use the code in the img. (I think I did everything you said besides the calc accel at the very end of your msg)
Going backward is “W” now and “S” is forward. (Controls got reversed) and it seems when I go backward I can then go forward to cancel that force. However when I go forward, I cannot stop. (The video I only pressed W once and it just keeps going)
Oh wait I had it plugged in wrong. It does work now and go back and forth upon hitting w and s and they go in the correct direction, however. Upon just hitting the key it goes to max speed lol. And also cannot turn
Yes that’s fine. that’s because we’re multiplying by values that might be very low (dt and input).
hmm i don’t see why. a lerp node is used almost identical to a finterp. i think i explained myself poorly.
Ok, maybe you need to use the Acceleration dampen code in the end.
it does work. i see the car moving. the problem is that the magnitudes of the forces is different.
hmmm no. that’s not what i meant.
a lerp with a static alpha is meaningless. you can simply calculate the value.
that code is not correct. the clamp needs to go at the end, and the lerp seems superfluous. but i don’t really know what you want to achieve so i can’t say how it should be.
if you just want to store the input like i said, just use InputValue = Clamp(ActionValue, -1, 1) no need for the lerp. that lerp is creating issues.
Sorry i think i forgot that analog values goes from -1 to 1. usually they will be clamped, but it’s worth having it in place until you get the base right. then you can try and remove it.
imo you have a few things you want to improve, but you added a bunch of patches. the problem is that the core logic is not solid, so it becomes a chunk of fiddly code. i strongly suggest to get the basic solid first, then see how to deal with the input issues.
For example i have an idea to deal with the input delay differently.
can you show me your new accelerate function?
is the speed correct in both fps?
yes because you don’t have acceleration damp. it’s ok, first try to get it without it, then we can add it back.
that might be my mistake when i said to clamp 0 to 1 instead of -1 to 1.
the fintepr has a ton of issues. it’s recommended in basic tutorials because it makes the code “look” simple, but nobody explains the issues because i don’t think youtubers understand it.
the only one that i recommend is matthew wadstein and epic ppl.