Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dynamic Curvy Spline Group
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 : 


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

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 : 

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 !
The problem might be that by adding another spline the same TF refers to a new location. So before adding, convert TF to Distance, add a spline and convert Distance back to TF.

Does that help?

Possibly Related Threads…
Thread Author Replies Views Last Post
  Odd behavior when drawing spline ricke 9 12 11-28-2022, 10:34 AM
Last Post: _Aka_
  Input Spline Shapes from Prefabs destroys graph tairoark 5 6 11-24-2022, 05:08 PM
Last Post: _Aka_
  Scale Deform Mesh Along Spline? / aligning colliders MamasToast 9 61 10-31-2022, 03:44 AM
Last Post: tairoark
Information Curvy 8.3.0 is live _Aka_ 0 5 10-27-2022, 10:54 AM
Last Post: _Aka_

Forum Jump: