Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Handling Connections with FollowSpline and Path Switching
#3
(05-20-2014, 12:08 PM)'Jake' Wrote: 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?


 

Hi Jake,

Thanks for the reply. I'll need to work through the pseudocode and see if I can convert it to working code (not quite completely adept at working in C# yet), but it'll give me a starting point. When you suggest making a subclass do you mean something like this?




Code:
public class FollowSpline
{}

public class Player_Movement : FollowSpline
{}


With regards to the smooth transition, I'll dig into the Endless runner example and see how I can adapt the concepts in that example . However I'm also intrigued by your suggestion of moving on two splines and lerping between them, would you be able to elaborate on that?
 

 
Reply


Messages In This Thread

Possibly Related Threads…
Thread Author Replies Views Last Post
  Rasterized Path Range issue proton 7 23 04-30-2024, 11:17 AM
Last Post: _Aka_
  Incorrect mesh alignment after extrusion on curved path Thinkurvy 10 21 04-17-2024, 10:57 AM
Last Post: _Aka_
  Connections Problem Juton 3 16 03-06-2024, 10:41 AM
Last Post: _Aka_
Wink Train carriage with 2 bogies following a path arcadeperfect 9 27 08-25-2023, 02:56 PM
Last Post: arcadeperfect

Forum Jump: