So ive been building an F-zero style racing game and ive gotten a system going where i use raycasts in order to run some complex calculations based on barycentric coordinates to set the rotation of the vehicle there are other topics on these very forums on the specifics, but that system works fine sorta, thats not really the issue, all you need to know is im using a raycast to get info from the geometry and using that to set the actor locaiton and rotations. The real problem is the raycast. you see im casting it in in the tick function, from there if the raycast is valid im calling a function that does all the calculations and then setting them accordinly, since the raycast is in event tick it is tied to the framerate so depending on the speed of the vehicle and the geometry of the track the raycast can miss at low frame rates as the casting interval is not as good as 60 and 120 and higher frame rates, the game is pretty bad to play at 60 fps and its absolutily unplayable at 30 fps which is a huge problem for a team member doing his development on a laptop. So i thought that hey ill just find out what the unreal engine equivlaent to fixed update from unity is. Turns out that doesn’t really exist. ive tried implementing subticking but im not really sure im doing it right and it doesn’t seem to work for calling custom logic and i found a blueprint node called async physics tick but it doesn’t seem to work and i can’t seem to find a C++ equivlanet of that event node. I am also not sure how helpful that event is given my vehicle is actually moving entirely kinematically with the floating pawn movement component. Not using the phyisics system helps make the game feel really good and gives me lots of control over how it plays. but if i need to move to using the physics system in part i can try to adapt it. if anyone needs to see code to help me ill post what i got so far.
There is a variable called Tick Interval from which you can set, in seconds how often the Tick function runs. PrimaryActorTick.TickInterval = 0.1f will set it to run 10 times a second.
You could try using the asynchronous version of line trace
You could link this with a timer with a set interval that would call the needed code
Would this run the same speed regardless of the frame rate going up or down? my main concern is trying to get the code to work consistently when the game is being run on a laptop that can only manage 30 fps or a beast pc with an uncapped framerate
the problem with this unfortunatly is if this is set to a certain rate and then the game is running slower than the set interval then its going to run slower, so its still tied to the framerate. the thing im trying to avoid.
You could try running it on a separate thread with FRunnable and having it only interact with the game loop at set times. Not sure how the async will work with it. It would probably need a test project to see the results. But at least the timing could be on a separate thread that is for sure.