Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Handling Connections with FollowSpline and Path Switching
#2
Hi,

the SplineWalkerCon, though still working, will become obsolete once the new Networking featues are in (Connections will only be used to visually connect curves then). But even then using a network map might be a bit overkill unless you need pathfinding etc.

I would go the FollowSpline route: Create your custom controlle as a subclass of FollowSpline and overwrite some logic (Refresh()!) to manage your connections. E.g. if you move with the PingPong clamp option, you are able to detect the end of spline easily by checking if the direction changed. If so, check the last CP and if connected to another Spline, switch splines and add the delta movement to the new spline. In Pseudocode:

Code:
override Refresh()
{
MoveBy(ref tf, ref dir,...,CurvyClamping.PingPong);
if (dir==-1) { // <=this assumes you're normally moving forward only. If not you'll need to handle start of splines as well, but the concept remain the same
tf=1-tf;
dir=1;
// Find new Spline
var lastCP=spline[spline.Count-1];
var con=lastCP.ConnectionAny;
if (con!=null) // connected? then get new spline
spline=con.GetCounterpart(lastCP).Spline;
else
LetMeCrashOrDieOrElse();

}
}

Another topic is smooth transition between splines midway. One way would be to drag the player toward the final position where he should be. See the EndlessPlayer example. It doesn't use a FollowSpline based controller, but you'll get the trick. Basically uncouple direct movement for your player if he's in "switch Lane" mode and drag him toward the desired target position until he completed the transition. Another way would be to "move" on two splines and lerp the results while in "Switch" mode.

Does that help?
Reply


Messages In This Thread

Possibly Related Threads…
Thread Author Replies Views Last Post
  Connections Between Opposing Splines lockiidraws 1 812 12-04-2025, 02:14 PM
Last Post: _Aka_
  Duplicate Prefab along path rickgplus 1 1,712 01-23-2025, 10:09 AM
Last Post: _Aka_
  Anomalous connection handling SAMYTHEBIGJUICY 1 1,533 12-04-2024, 05:08 PM
Last Post: _Aka_
  Procedural Connections Janooba 3 2,606 10-23-2024, 02:53 PM
Last Post: _Aka_

Forum Jump: