Hi guys. I am working on a car configurator and I want the car to come driving into the scene. Currently I am manually tweaking the throttle and Brake so that it arrives at my desired destination. The issue is, that it stops at different positions almost every time I run it. The simulation seems to be affected by system resources (if I do other stuff, e.g. move the camera or whatever, it slows down the process, and the sim seems to skip a few steps, ending in the car stopping sooner).
Any idea how to solve this? Is there a way to point the car to what exact position it should stop, so that I dont need to guess the throttle and brake values?
Iām currently using this setup. The sequence first makes the car follow the path, Use Throttle, and after a delay, it uses the brakes. Iād appreciate any insight into a better solution to this, as itās very finicky and unpredictable!
I would like to try @darusoftware 's approach first as Iād have more control over the animation in the long-run and can fine-tune the settings. So you know how to get the car to stop when it reaches the end of the curve? What nodes would I need for that?
There is that āFinishedā pin that fires from your timeline when you reach the end of the curve, but I donāt think that will solve the problem of the curve values getting processed differently based on FPS.
That question did spark another idea - what if you have a collision box, and when the car enters it, the collision box sends a message to the car telling it to brake.
Maybe this way any differences in throttle wont matter and possibly the braking will happen so fast that even small variances due to frametime fluctuations wont matter.
BTW you can type āt.maxfps 30ā into the console to lock a lower framerate for testing.
Iām currently trying it out, but Iām not sure what Iām doing wrong. That car drives along the curve, but it doesnt stop when it enters the collision box. From my understanding this is a basic āIf-Thenā operation. If car is in box ā use brakes. What is wrong in my blueprint? Do you see anything obvious?
Just to add to what others have said, the physics are non deterministic, even given a constant time step it might not always look the same, especially on different systems. Also, if you happen to adjust the car physics (power or something else) the car drives differently and you would have to readjust your animation. The most reliable way would be to simply disable physics and push the car along with an animation, also animating the wheels. Making a simple AI to brake at a set point will probably also work fine.
Right now your collision box is attached to your car, meaning it will push it along and never reach it. You would either have to make itās location absolute in the properties panel, detach it on BeginPlay or move it to a separate blueprint.
Okay, so I went and did the whole ātake recordingā route, and it works within the recorded sequence, but the animation itself is static with only the wheels having been animated. How do I get the entire object transformation included here?
At the moment I am using the āPlay animtionā node to play the recorded animation at āEvent BeginPlayā.
I managed to solve the issue by using a āTrace Lineā node.
I am adding an object to the right side of the platform where it should stop on. The Lien trace detects the static mesh and then uses the āif trueā state to trigger the brakes.