Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Best practice for controllers slowing down/speeding up along the spline
#1
Hello all!

I'm trying to build a race circuit viewed from the top, with cars (as dots) moving along the path, like this:

[Image: MNzqBpo.png]

To be somewhat credible, I don't want the cars to have uniform speed, as they should slow down at the entry of a turn, and speed up at the exit. I just need something simple however.

What would be the best way to achieve that? I was thinking maybe setting up multiple "slowdown" / "speedup" events along the path? In that case, could I pass along something like an AnimatedCurve as a parameter, to better control the change of speed, or am I limited to bool/float/string?

Thank you, cheers!
Reply
#2
Hi
I see few ways of doing it:
  1. The one you suggested, using custom events: These events are implemented using regular Unity. I can't try it for now yo be sure (I am on vacation), but try making a public method that takes an AnimationCurve, and see if the event can call it)
  2. Automatic speed variation based on the tangent variation: Change the speed of the controller based on the curvature of the track. You can compute it by computing the delta between the spline tangent at a specific point vs at a point slightly before.
  3. Using MetaData. Scene 01_MetaData shows how a controller has a height variation using meta data. You can do something similar to modify the speed.
    I hope this helped. Have a nice day
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Available for freelance work—feel free to reach out.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Disable a spline's gizmo when not selected or disabled. mikechr2000 1 154 02-03-2025, 09:34 AM
Last Post: _Aka_
Information Questions regarding spline colliders and collisions with rigidbodies Spyboticer 7 551 01-20-2025, 12:25 PM
Last Post: _Aka_
  Extrude mesh along spline. New and confused user GhostStalker 3 240 01-02-2025, 09:58 AM
Last Post: _Aka_
  Newly created spline is invisible quickytools 7 556 12-21-2024, 10:14 AM
Last Post: _Aka_

Forum Jump: