Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dynamic Curvy Spline Group
#1
Hi, for my endless runner, I'm trying to instantiate and connect "on the fly" curvy splines.
Connections work perfectly, I have portions of my path connecting and instantiating at correct positions, however, I have difficulties to Interpolate correct positions, certainly because the CurvySplineGroup I'm running in is changing over time.

This is code I'm using : 

Over the time, i'm adding splines[] to my main group : 



Code:
centerGroup.Add(newSplineLDData.centerSplines);

And I use a tweaked version of your EndlessRunner.cs script : 


Code:
Vector3 newPosOnSpline = SplineGroup.MoveBy(ref TF, ref dir, Speed * Time.deltaTime, CurvyClamping.PingPong);
Vector3 newTangent = SplineGroup.GetTangent(TF);

mTransform.position += newPosOnSpline - mLastPosOnSpline;

Problem is : as soon as i connect new CurvySplines with centerGroup.Add(newSplineLDData.centerSplines); my character kind of teleport forward, trying to reach its new position, cause, I guess, Interpolation changed from my simple group to the same group with the new spline coming.

Do you know can I reach this purpose ?
I try to seamlessly run through different curvy splines. I used to use your method, with simple CurvySplines connected as the path is getting longer, it works, but sometimes character is blocked, saying he can't find next spline. That's the reason I tried to change the way to connect spline from CurvySpline to SurvySplineGroup. --> Just trying to avoid random blocking issues...

How to endlessly run through dynamically instantiated Splines without using this portion of code that sometimes completly block the game : 





Code:
if(dir != 1) {
CurvySpline newSpline;
float newTF;
if(RaycastForFollowUpSpline(mTransform.forward, out newSpline, out newTF)) {
// we found a new spline underneath us. Let's use it from now on
Spline = newSpline;
TF = newTF;
newPosOnSpline = Spline.Interpolate(TF);
avatarController.SetInAir((newPosOnSpline - mTransform.position).sqrMagnitude > 0.001f);
} else {
Speed = 0;
}
}*


Thanks a lot !
Reply


Messages In This Thread
Dynamic Curvy Spline Group - by lelag - 11-05-2014, 11:11 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Best way to duplicate a spline with an offset Kapistijn 8 1,349 04-12-2026, 03:18 PM
Last Post: _Aka_
Smile Constant speed along a spline? tfishell 1 654 11-13-2025, 11:32 AM
Last Post: _Aka_
  SplineController Ignores Follow-Up and Chooses Wrong Spline Josenildo 7 4,452 07-29-2025, 09:15 PM
Last Post: _Aka_
  Curvy Line Renderer for UI Spline? gekido 7 6,202 07-13-2025, 07:11 PM
Last Post: _Aka_

Forum Jump: