Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Issue Keeping Rigidbody Player Following Spline
#1
Question 
With Curvy 1.6 I used the following code to keep my custom rigidbody controller aligned to a spline in the X axis.

Code:
Vector3 splinePosition = Spline.Interpolate(TF);
// Bring the player back onto the spline if they drift from it i.e. running round curves etc.
Vector3 offset = new Vector3(transform.position.x - splinePosition.x, 0, 0);
if (offset.sqrMagnitude > 0.001f)
{
    transform.position -= offset.normalized * Time.deltaTime;
}

However after upgrading to Curvy 2, this code no longer functions as expected. The controller follows the overall shape of the spline, but is not aligned to it i.e. following along on top of the tangents/curve.

I assume that my approach is now outdated in Curvy 2, but i am at a loss as to work out how to upgrade it. 

So if anyone has any hints/suggestions, I'd appreciate the assistance.
Reply


Messages In This Thread
Issue Keeping Rigidbody Player Following Spline - by Yog-Shoggoth - 12-22-2015, 08:19 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Spline Spots from 2 samples. BitBlit 8 429 06-30-2026, 11:49 AM
Last Post: _Aka_
  Best way to duplicate a spline with an offset Kapistijn 8 1,936 04-12-2026, 03:18 PM
Last Post: _Aka_
Smile Constant speed along a spline? tfishell 1 839 11-13-2025, 11:32 AM
Last Post: _Aka_
  SplineController Ignores Follow-Up and Chooses Wrong Spline Josenildo 7 4,824 07-29-2025, 09:15 PM
Last Post: _Aka_

Forum Jump: